AngularJS - jQuery UI - binding issue

后端 未结 7 1461
盖世英雄少女心
盖世英雄少女心 2021-01-02 10:14

I am currently porting a large application over to a HTML5 based web app - I have started building the app in AngularJS and enjoying the power of the AngularJS framework - I

7条回答
  •  傲寒
    傲寒 (楼主)
    2021-01-02 11:09

    http://jsfiddle.net/9BRNf/74/ here is the solution :)

    code:

         var myApp = angular.module('myApp', ['myApp.directives']);
    
    
        function MainCtrl() {
    
        }
    
        angular.module('myApp.directives', [])
          .directive('myDatepicker', function() {
              return {
                 require: '?ngModel',
                    link: function (scope, element, attrs, ngModelCtrl) {
              element.datepicker({
                 changeYear : true,
                 changeMonth : true,
                 appendText : '(yyyy-mm-dd)',
                 dateFormat : 'yy-mm-dd',
                  onSelect: function(date) {
                      ngModelCtrl.$setViewValue(date);
                                scope.$apply();
                  }
              });
            }
          }
    
      });
    

提交回复
热议问题