我只是想为我使用http://uniformjs.com jquery 插件和 angularjs 的复选框设置样式。
这是我想用插件设置样式的复选框输入元素:
<label><input type="checkbox" plugin-uniform id="inline"> Inline editing</label>
这是我为此编写的自定义指令:
myApp.directive('pluginUniform', function() {
return {
restrict: 'A',
link: function(scope, element, attrs) {
Layout.initUniform();
}
};
});
这是Layout.initUnform()代码:
var Layout = function() {
//other stuff
initUniform: function (els) {
if (els) {
jQuery(els).each(function () {
if ($(this).parents(".checker").size() == 0) {
$(this).show();
$(this).uniform();
}
});
} else {
handleUniform();
}
}
function handleUniform() {
if (!jQuery().uniform) {
return;
}
var test = $("input[type=checkbox]:not(.toggle), input[type=radio]:not(.toggle, .star)");
if (test.size() > 0) {
test.each(function () {
if ($(this).parents(".checker").size() == 0) {
$(this).show();
$(this).uniform();
}
});
}
}
//other stuff
}
我已经准备uniform.default.css好jquery.uniform.js了。
有人可以告诉我如何使用自定义指令将浏览器默认复选框样式设置为 angularjs 中的http://uniformjs.com jQuery 插件复选框样式?