import { Component } from '@angular/core' ; @ Component ( { templateUrl : 'page-one.html' } ) export class PageOne { items : Array < string > ; ngOnInit ( ) { this . setItems ( ) ; } setItems ( ) { this . items = [ 'Orange' , 'Banana' , 'Pear' , 'Tomato' , 'Grape' , 'Apple' , 'Cherries' , 'Cranberries' , 'Raspberries' , 'Strawberries' , 'Watermelon' ] ; } filterItems ( ev ) { this . setItems ( ) ; let val = ev . target . value ; if ( val && val . trim ( ) !== '' ) { this . items = this . items . filter ( function ( item ) { return item . toLowerCase ( ) . includes ( val . toLowerCase ( ) ) ; } ) ; } } }