1 |
57592
|
stefania.m
|
import { Component, DoCheck, OnInit, ViewEncapsulation } from '@angular/core';
|
2 |
|
|
import { DataService } from '../../services/data.service';
|
3 |
|
|
import { OverviewData } from '../../domain/overview-data';
|
4 |
|
|
|
5 |
|
|
@Component({
|
6 |
|
|
selector: 'app-home',
|
7 |
|
|
templateUrl: './home.component.html',
|
8 |
|
|
// styleUrls: ['./top-menu.component.css'],
|
9 |
|
|
encapsulation: ViewEncapsulation.None
|
10 |
|
|
})
|
11 |
|
|
|
12 |
|
|
export class HomeComponent implements OnInit {
|
13 |
|
|
|
14 |
|
|
overviewData: OverviewData;
|
15 |
|
|
|
16 |
|
|
countrySelectedName: string = null;
|
17 |
|
|
|
18 |
|
|
constructor(private dataService: DataService) { }
|
19 |
|
|
|
20 |
|
|
ngOnInit(): void {
|
21 |
|
|
this.dataService.getOverviewData().subscribe(
|
22 |
|
|
overviewData => {
|
23 |
|
|
this.overviewData = overviewData;
|
24 |
|
|
},
|
25 |
|
|
error => {
|
26 |
|
|
console.log(error);
|
27 |
|
|
}
|
28 |
|
|
);
|
29 |
|
|
}
|
30 |
|
|
|
31 |
|
|
countrySelected(countryName: string) {
|
32 |
|
|
console.log('Country selected: ', countryName);
|
33 |
|
|
this.countrySelectedName = countryName;
|
34 |
|
|
}
|
35 |
|
|
|
36 |
|
|
deselectCountry() {
|
37 |
|
|
this.countrySelectedName = null;
|
38 |
|
|
}
|
39 |
|
|
}
|