I found a jquery-ui angular date picker directive to use. It works fine except the format when it is populated with a date from the db. right now it shows 2014-08-10T00:00:00. I need the mm-dd-yy format. also when I open the datepicker the default value is todays date, I need it to show up on the date from the db. I cannot use angular-ui datepicker because of the design and look. thanks plunkr
app.directive("datepicker1", function () {
return {
restrict: "A",
require: "ngModel",
link: function (scope, elem, attrs, ngModelCtrl) {
var updateModel = function (dateText) {
// call $apply to bring stuff to angular model
scope.$apply(function () {
ngModelCtrl.$setViewValue(dateText);
});
};
var options = {
dateFormat: "dd-mm-yy",
// handle jquery date change
onSelect: function (dateText) {
updateModel(dateText);
}
};
// jqueryfy the element
elem.datepicker(options);
}
}
});
<input type="text" style="width:150px" ng-model="currentItem.ChangeOrderDate" datepicker1 />