Is it possible to know whether dirictive active or not? Such as if I have something similar code
<my-dir><my-dir>
<div ng-show='my-dir'></div>
This purpose is important for me when I comment out my directive inside of div should not shown. That's why I set ng-show
for that you must create a variable that checks which have an established directive, example:
.directive("myDir", function(){
return {
restrict: 'E',
link:function($scope){
$scope.myDir = true
}
}
})
<my-dir><my-dir>
<div ng-show='myDir'>on</div>
Or simplifying:
<my-dir ng-init="myDir = true"><my-dir>
<div ng-show='myDir'>on</div>
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다