0

我正在使用以下 AngularJS 指令将Uniform jQuery 插件与 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>

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

4

1 回答 1

2

尝试这个:

window.onload = function(){       
    // initiate layout and plugins
    ...
    setTimeout(function(){ $.uniform.update(); }, 300);
};
于 2015-01-05T20:11:14.053 回答