如何根据“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>