open-science-observatory-ui/src/app/pages/home/home.component.ts

40 lines
954 B
TypeScript

import { Component, DoCheck, OnInit, ViewEncapsulation } from '@angular/core';
import { DataService } from '../../services/data.service';
import { OverviewData } from '../../domain/overview-data';
@Component({
selector: 'app-home',
templateUrl: './home.component.html',
// styleUrls: ['./top-menu.component.css'],
encapsulation: ViewEncapsulation.None
})
export class HomeComponent implements OnInit {
overviewData: OverviewData;
countrySelectedName: string = null;
constructor(private dataService: DataService) { }
ngOnInit(): void {
this.dataService.getOverviewData().subscribe(
overviewData => {
this.overviewData = overviewData;
},
error => {
console.log(error);
}
);
}
countrySelected(countryName: string) {
console.log('Country selected: ', countryName);
this.countrySelectedName = countryName;
}
deselectCountry() {
this.countrySelectedName = null;
}
}