我想为persian datepicker创建一个angular指令,我要使用的
javascript lib是
http://jspersiandatepicker.codeplex.com/,我的代码是:
<input type="text" persiandatepicker ng-model="mydate" />{{mydate}} directive('persiandatepicker',function() { return { restrict: 'A',require: '?ngModel',link: function (scope,element,attrs,ngModel) { if (!ngModel) return; ngModel.$render = function () { element.bind("click",function () { PersianDatePicker.Show(this,ngModel.$viewValue || ''); }); }; } }; });
这个代码显示datepicker当点击输入时和选择日期显示在输入中,但模型没有绑定而不改变我怎么能在这个样本中进行绑定?
plunker中的这个链接是我的代码:http://plnkr.co/edit/AQsvlbdGHCVpjMeCbR3c?p=preview
解决方法
目前有一个很好的可用.这是一个波斯角度日历:
Amin Rahimi’s angularjs Datepicker
Amin Rahimi’s angularjs Datepicker