Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Binding date value to ng-model in angular kendo date picker

I have an api which return the date in this format "014-08-26T15:10:45.402Z" i am using angular kendo ui .The problem i am facing is the date is not getting bound to the kendo date picker.Could someone help me out .

         <input kendo-date-picker ng-model="emp.datestart" k-format="MM/dd/yyyy" />
like image 401
sam rodrigues Avatar asked Aug 26 '14 15:08

sam rodrigues


Video Answer


1 Answers

In order to have the Kendo DatePicker working with a string date value model you need:

1) Use k-ng-model instead of ng-model.

2) Tell the widget in which exact format the date will be parsed.

<input kendo-date-picker k-ng-model="emp.datestart" k-options="datePickerOptions" />

Then at your AngularJS controller you will specify the date parsing format, for example:

$scope.datePickerOptions = {
    parseFormats: ["yyyy-MM-ddTHH:mm:ss"]
};
like image 184
Paulo Soto Avatar answered Oct 09 '22 23:10

Paulo Soto