ng2-ui / datetime-picker

Angular2 DateTime Picker
https://ng2-ui.github.io/#/datetime-picker
MIT License
121 stars 62 forks source link

the module should provide a change event interface #90

Closed lzm420241 closed 7 years ago

lzm420241 commented 7 years ago

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.

allenhwkim commented 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

lzm420241 commented 7 years ago

for first time , it has been triggered ngModelChange if you init model data!

https://plnkr.co/edit/ckFvt2TdlJEyek0Ypgcs?p=preview&open=app.component.ts

allenhwkim commented 7 years ago

@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.