Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ngModelChange only on blur if there was change

Tags:

angular

I want to only call updateDetail() on the blur event and only if the model has changed. So right now if the user blurs (tabs) out of the input box without making a change it will call updateDetail() and perform unnecessary calculations. Can someone please remove my ignorance?

<input type="text" (ngModelChange)="updateDetail(d)" [ngModelOptions]="{updateOn: 'blur'}" name='detail-monthly-payment'
                            [(ngModel)]="d.periodPayment" />
like image 792
Maccurt Avatar asked Nov 20 '17 12:11

Maccurt


1 Answers

Use just (change) in place of (ngModelChange)


I think, This issue is no more with Angular5, Please check

WORKING DEMO

like image 109
Vivek Doshi Avatar answered Oct 18 '22 13:10

Vivek Doshi