Closed lzm420241 closed 7 years ago
You should use ngModelChange
instead of change
because it does not manually invoke change
event because it is changed by program not manually.
I do not think it's recommened by community to fire change
event if the input contents are changed by program.
https://plnkr.co/edit/spamdZ?p=preview&open=app.component.ts
for first time , it has been triggered ngModelChange if you init model data!
https://plnkr.co/edit/ckFvt2TdlJEyek0Ypgcs?p=preview&open=app.component.ts
@lzm420241 that's angular2 behaviour. I can't do much about it. You can raise that issue at stackoverflow or angular2 github. Maybe, there might be a way not to fire ngModelChange event for the first time, which that I don't know of.
when i add change event in input element by using the module, i find the change event did not work! i guess the module had listened the change event.