2014-12-02 111 views
0

我使用以下AngularJS指令的jQuery插件统一到Uniform jQuery插件集成了angularjs使用与AngularJS

myApp.directive('pluginUniform', function() { 
    return { 
     restrict: 'A', 
     link: function(scope, element, attrs) { 
      element.show().uniform(); 
      if (!element.parents(".checker").length) { 
       element.show().uniform(); 
      } 

     } 
    }; 
}); 

我遇到的问题是,它并没有显示检查ng-checked="true"值。但是,当我删除plugin-uniform属性时,它显示正确的结果。

例如,在控制器中设置值$scope.isEmailChecked = true;,但以下代码ng-checked="isEmailChecked"未显示已选中的复选框。

<div class=""> 
    <label> 
     <input type="checkbox" plugin-uniform ng-model="isEmailChecked" ng-true-value="true" ng-false-value="false" ng-checked="isEmailChecked"> 
     I agree 
    </label> 
</div> 

有人能帮我解决这个问题吗?

回答

2

试试这个:

window.onload = function(){  
    // initiate layout and plugins 
    ... 
    setTimeout(function(){ $.uniform.update(); }, 300); 
};