import { Component } from '@angular/core' ; import { Facet } from '@ux-aspects/ux-aspects' ; import { Observable , Observer } from 'rxjs' ; @ Component ( { selector : 'facet-typeahead-list-app' , templateUrl : './facet-typeahead-list.testpage.component.html' } ) export class FacetTypeaheadListPageComponent { facets : Observable < Facet [ ] > ; suggestions : Facet [ ] = [ ] ; query : string = '' ; users : Facet [ ] = [ ] ; constructor ( ) { for ( let idx = 0 ; idx < 1000 ; idx ++ ) { this . users . push ( new Facet ( `Person ${ idx }` , null , idx ) ) ; } this . users . sort ( ( userOne , userTwo ) => { if ( userOne . title < userTwo . title ) { return - 1 ; } if ( userOne . title > userTwo . title ) { return 1 ; } return 0 ; } ) ; this . suggestions = this . users . slice ( 0 , 6 ) ; this . facets = Observable . create ( ( observer ) => { setTimeout ( ( ) => { observer . next ( this . users ) ; } ) ; } ) ; } }