0
我只是想样式里面我是用http://uniformjs.com与angularjs jQuery插件的复选框Unform 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 () code:
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插件复选框样式?
是的,它现在的工作,谢谢:)。但它现在在控制台上给我这个错误'TypeError:undefined不是''input type =“复选框”plugin-uniform =“”id =“autoopen”>'和''。 – skip 2014-09-13 21:51:18
您是否在页面中包含jQuery之前包含jQuery?这是需要使'angular.element'使用jQuery – charlietfl 2014-09-13 21:53:27
是的,它在angularjs库之前。 – skip 2014-09-13 21:54:54