Project

General

Profile

1
import { Component } from '@angular/core';
2
import { Router } from '@angular/router';
3
import { countries } from '../../domain/countries';
4

    
5
@Component({
6
  selector: 'app-top-menu',
7
  templateUrl: './top-menu.component.html',
8
})
9

    
10
export class TopmenuComponent {
11

    
12
  countriesCollection = countries;
13
  keyword = 'name';
14

    
15
  constructor(private router: Router) {
16
  }
17

    
18
  isHomeRoute() {
19
    return (this.router.url === '/home');
20
  }
21

    
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
}
(2-2/2)