如何根據「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全部小寫的模板? –