I have a page with multiple dropdowns as filters and I have a function listener for when any dropdown changes to update filtering.
<select [(ngModel)]="filters.foo" (change)="update()">...</select>
<select [(ngModel)]="filters.bar" (change)="update()">...</select>
<select [(ngModel)]="filters.quz" (change)="update()">...</select>
<select [(ngModel)]="filters.lol" (change)="update()">...</select>
<select [(ngModel)]="filters.wtf" (change)="update()">...</select>
But when my update()
function is executed the filters object hasn't been updated yet.
This plunker shows the issue, load the page and type anything on the inputs:
How can I call update()
only after the model has been updated?