texas697
texas697

Reputation: 6387

How to populate a html 5 date input

I have a modal that opens with form data to be edited. Everything populates correctly except the date input. When I put a date in there it saves and updates fine so is it a format issue? The input field is showing mm/dd/yy when the modal opens. plunkr

<label style="margin-left:296px">Date:</label>
                                            <input style="width:150px" ng-model="currentItem.ChangeOrderDate" type="date" />

Upvotes: 0

Views: 228

Answers (1)

PSL
PSL

Reputation: 123739

You should convert the string to date object before populating.

$scope.currentItem = {ChangeOrderDate  : new Date('2014-08-27T07:41:43.803')}; 

Plnkr

Upvotes: 2

Related Questions