angularjs and jquery ui datepicker not work

refer:

http://stackoverflow.com/questions/10727207/angularjs-jquery-ui-binding-issue

http://jsfiddle.net/9BRNf/2/

<input id=”date2″ value=”1/1/1980″ ng-model=”toDate” my-datepicker />
angular.module(‘myApp.directives’, [])
.directive(‘myDatepicker’, function() {
return function(scope, element, attrs) {

element.datepicker({
changeYear : true,
changeMonth : true,
appendText : ‘(yyyy-mm-dd)’,
dateFormat : ‘yy-mm-dd’,
onSelect: function(dateText, inst) {
var mdlAttr = $(this).attr(‘ng-model’);
scope[attrs.ngModel] = dateText;
scope.$apply();
}
});

}
});

This entry was posted in Program and tagged , . Bookmark the permalink.

发表评论

电子邮件地址不会被公开。 必填项已用*标注

您可以使用这些HTML标签和属性: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>