angular - angular2 change of datepicker's date can't trigger ngModelChange -
in html:
<input mdinput [(ngmodel)]="start" (ngmodelchange)="change()" [mddatepicker]="picker" placeholder="choose date"> <md-datepicker-toggle mdsuffix [for]="picker"></md-datepicker-toggle> <md-datepicker #picker></md-datepicker>
and in component.ts:
class component { public start: date; public change() { console.log(111); } }
on web page, if click toggle change datepicker's date. print 111
in console. if change date in ts
file this.start = new date()
, not print 111
. datepicker on web page has changed.
try (datechange)="nameofyourfunction($event)"
Comments
Post a Comment