에 NG-불확정 속성에 대한 지시문은 체크 박스에서 불확실한 상태를 처리하는 지침입니다 단순히 필요AngularJS와 사용자 정의 체크 박스
<ul ng-repeat="item in data">
<li>
<input type="checkbox" ng-indeterminate="{{item.displayed > 0 && item.displayed < item.total}}" ng-checked="item.displayed > 0" />
{{item.name}} ({{item.displayed}}/{{item.total}})
</li>
</ul>
일없이 NG-불확실한 표현을 쓸 수있는 방법이 있나요 e 이중 - 곱슬 표기법, 네이티브 - 체크 하나?
ng-indeterminate="item.displayed > 0 && item.displayed < item.total"
내가 시도 :
.directive('ngIndeterminate', function($compile) {
return {
restrict: 'A',
link: function(scope, element, attributes) {
attributes.$observe('ngIndeterminate', function(value) {
$(element).prop('indeterminate', $compile(value)(scope));
});
}
};
})
그러나 나는 다음과 같은 오류 얻을 :
Looking up elements via selectors is not supported by jqLite!
Here is a fiddle 당신이 함께 플레이 할 수 있습니다.
이런 식으로 뭔가? http://jsfiddle.net/d9rG7/1/ –