So I have the following html:
<div>
<ion-item id="homeTrigger" color="dark"></ion-item>
<ion-modal trigger="homeTrigger">
<ng-template>
<ion-header color="dark" translucent>
<ion-toolbar color="dark">
<ion-searchbar [(ngModel)]="searchTerm" (ionChange)="setFilteredItems($event.target.value)"></ion-searchbar>
</ion-toolbar>
</ion-header>
<ion-content color="dark">
<ion-list>
<ion-item color="dark" *ngFor="let item of worldArray;"> {{ item.title }} </ion-item>
</ion-list>
</ion-content>
</ng-template>
</ion-modal>
<div>
public worldArray: any = [];
public setFilteredItems(searchTerm) {
this.service.searchService(searchTerm).then((res) => {
this.worldArray.splice(this.worldArray.length - 1, 1);
this.worldAirportsArray = res;
console.log(JSON.stringify(this.worldArray));
});
}
Now when searching the worldArray is updated. But the view inside the model is not. If I place the search functionality outside the model then the view updates. So how can I make it so that the list in the model updates. Note if I close the model then reopen it then the updated list is show.
Wondering how I can fix this?
Thanks