I want to call datepicker using angularjs. I have tried with some piece of code, can someone help me on what is missing. In html tag getting "unknown attribute datepicker". Appreciate you help.Thanks.
<input ng-model="datePicker" id="txt_parentcrid" type="text" placeholder=":input" datepicker/>
var app = angular.module("myApp", []);
app.directive("datepicker", function () {
return {
restrict: "A",
require: "ngModel",
link: function (scope, elem, attrs, ngModelCtrl) {
var updateModel = function (dateText) {
scope.$apply(function () {
ngModelCtrl.$setViewValue(dateText);
});
};
var options = {
dateFormat: "dd/mm/yy",
onSelect: function (dateText) {
updateModel(dateText);
}
};
elem.datepicker(options);
}
}
});