12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970 |
- import {Component, OnInit} from '@angular/core';
- import {CountryService} from '../service/countryservice';
- import {AppBreadcrumbService} from '../../app.breadcrumb.service';
-
- @Component({
- templateUrl: './invalidstatedemo.component.html'
- })
- export class InvalidStateDemoComponent implements OnInit {
-
-
- countries: any[];
-
- cities: any[];
-
- filteredCountries: any[];
-
- value1: any;
-
- value2: any;
-
- value3: any;
-
- value4: any;
-
- value5: any;
-
- value6: any;
-
- value7: any;
-
- value8: any;
-
- value9: any;
-
- constructor(private countryService: CountryService, private breadcrumbService: AppBreadcrumbService) {
- this.breadcrumbService.setItems([
- {label: 'UI Kit'},
- {label: 'Invalid State', routerLink: ['/uikit/invalidstate']}
- ]);
-
- this.cities = [
- {name: 'New York', code: 'NY'},
- {name: 'Rome', code: 'RM'},
- {name: 'London', code: 'LDN'},
- {name: 'Istanbul', code: 'IST'},
- {name: 'Paris', code: 'PRS'}
- ];
- }
-
- ngOnInit() {
- this.countryService.getCountries().then(countries => {
- this.countries = countries;
- });
- }
-
- searchCountry(event) {
- // in a real application, make a request to a remote url with the query and return filtered results,
- // for demo we filter at client side
- const filtered: any[] = [];
- const query = event.query;
- for (let i = 0; i < this.countries.length; i++) {
- const country = this.countries[i];
- if (country.name.toLowerCase().indexOf(query.toLowerCase()) == 0) {
- filtered.push(country);
- }
- }
-
- this.filteredCountries = filtered;
- }
- }
|