我正在编写一个角度应用程序,我希望根据Kendo Date Picker的更新值来调用API。 Kendo Date Picker绑定到Angular Model但是,在更改日期之后,我在模型变量中得到相同的旧值(最初赋值)。以下是我正在使用的Typescript和HTML代码。我错过了什么吗?
HTML:
<input id="datepicker" kendo-datepicker k-ng-model="StartDate" value="{{StartDate}}" />
<button type="button" class="btn btn-primary" (click)="save();">Save</button>
代码:
export class AdminPeriodConfigurationComponent {
StartDate: any;
constructor(private _router: Router, private _globalService: GlobalService){
}
loadData(){
this.StartDate="09/28/2016";// format is "mm-dd-yyyy" and this value binds to datepicker
}
ngOnInit() {
this.loadData();
}
save(){
var myobj=new MyClass();
myobj.NewSelectedDate=this.StartDate; // here the updated value does not get assigned.
}
}