如何根据“bindto”属性获取以下复选框以进行检查?我试过element.checked = true
,它没有检查复选框。有什么建议么?未检查角度指令
directive('slideToggle', function() {
return {
replace: true,
restrict: 'E',
scope: {
bindto: '='
},
template: '<input type="checkbox" name=""/>',
link: function (scope, element, attrs) {
console.log(scope); //shows scope.bindto as "true"
console.log(scope.bindto); //undefined
}
}
}).
用法:
<slide-toggle bindTo="myItem.active"></slide-toggle>
是应该有bindTo驼峰和指令bindto全部小写的模板? –