I have almost exactly the same code as you and mine works.
Do you have jQueryUI.js included in the page?
There's a fiddle here
<input type="text" ng-model="date" jqdatepicker />
<br/>
{{ date }}
var datePicker = angular.module('app', []);
datePicker.directive('jqdatepicker', function () {
return {
restrict: 'A',
require: 'ngModel',
link: function (scope, element, attrs, ngModelCtrl) {
element.datepicker({
dateFormat: 'DD, d MM, yy',
onSelect: function (date) {
scope.date = date;
scope.$apply();
}
});
}
};
});
You'll also need the ng-app="app" somewhere in your HTML
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…