Project

General

Profile

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