1
|
import { Component } from '@angular/core';
|
2
|
import { Router } from '@angular/router';
|
3
|
import { countries } from '../../domain/countries';
|
4
|
import { environment } from '../../../environments/environment';
|
5
|
|
6
|
@Component({
|
7
|
selector: 'app-top-menu',
|
8
|
templateUrl: './top-menu.component.html',
|
9
|
})
|
10
|
|
11
|
export class TopmenuComponent {
|
12
|
|
13
|
countriesCollection = countries;
|
14
|
keyword = 'name';
|
15
|
|
16
|
environmentName = environment.environmentName;
|
17
|
|
18
|
constructor(private router: Router) {
|
19
|
}
|
20
|
|
21
|
isHomeRoute() {
|
22
|
return (this.router.url === '/home');
|
23
|
}
|
24
|
|
25
|
selectCountryFromAutocompleteEvent(item) {
|
26
|
// do something with selected item
|
27
|
// console.log('country selected: ', item);
|
28
|
this.router.navigate([`/countryDashboard/${item.id}`]);
|
29
|
}
|
30
|
|
31
|
onChangeSearch(search: string) {
|
32
|
// fetch remote data from here
|
33
|
// And reassign the 'data' which is binded to 'data' property.
|
34
|
}
|
35
|
|
36
|
onFocused(e) {
|
37
|
// do something
|
38
|
}
|
39
|
}
|