angular directive ngmodel with jquery ui datepicker

来源:互联网 发布:潘多拉 设置网络 编辑:程序博客网 时间:2024/05/16 08:16
  1. app.directive('datepicker',function(){
  2. return{
  3. restrict:'A',
  4. require:'ngModel',
  5. link:function(scope, element, attrs, ngModelCtrl){
  6. $(function(){
  7. element.datepicker({
  8. dateFormat:'dd/mm/yy',
  9. onSelect:function(date){
  10. scope.$apply(function(){
  11. ngModelCtrl.$setViewValue(date);
  12. });
  13. }
  14. });
  15. });
  16. }
  17. }
  18. });

<input ng-model="property"....
0 0