Angular directive checking active or not

Shaxrillo

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

Walter Chapilliquen - wZVanG

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] 삭제

에서 수정
0

몇 마디 만하겠습니다

0리뷰
로그인참여 후 검토

관련 기사

분류에서Dev

Update data in angular directive

분류에서Dev

Angular directive modifying scope

분류에서Dev

angular order with directive

분류에서Dev

Angular Directive not for child element

분류에서Dev

Angular Directive not for child element

분류에서Dev

Angular directive showing in the wrong place

분류에서Dev

Angular Click outside of an element in directive

분류에서Dev

Angular directive that requires another directive that uses an Attribute defined controller

분류에서Dev

Angular Directive 여러 번 호출

분류에서Dev

problems creating a styled checkbox directive for angular app

분류에서Dev

Angular Directive 요소 문제

분류에서Dev

Is one of these the more "Angular" way of communicating with a directive?

분류에서Dev

Angular.js directive isolated scope not working

분류에서Dev

Angular Directive 부모 템플릿?

분류에서Dev

angular leaflet directive:: check if point is in polygon

분류에서Dev

Angular.js directive isolated scope not working

분류에서Dev

Creating custom angular directive for term.js

분류에서Dev

Use an Angular directive to generate html from an array

분류에서Dev

angular directive - scope undefined inside function

분류에서Dev

angular directive ng-repeat scope and Service

분류에서Dev

Angular ngrepeat multiple items in an array using directive

분류에서Dev

Change src img directive or filter angular

분류에서Dev

Define a function for ng-click in an Angular directive

분류에서Dev

Angular directive link function never runs

분류에서Dev

Reload directive method after POST in Angular JS

분류에서Dev

JQuery not detecting DOM elements inside angular directive

분류에서Dev

Confirm password custom directive is not working in Angular

분류에서Dev

Angular, nested directive repeats, pass if parent is $last

분류에서Dev

Angular.js call jquery function in Directive

Related 관련 기사

  1. 1

    Update data in angular directive

  2. 2

    Angular directive modifying scope

  3. 3

    angular order with directive

  4. 4

    Angular Directive not for child element

  5. 5

    Angular Directive not for child element

  6. 6

    Angular directive showing in the wrong place

  7. 7

    Angular Click outside of an element in directive

  8. 8

    Angular directive that requires another directive that uses an Attribute defined controller

  9. 9

    Angular Directive 여러 번 호출

  10. 10

    problems creating a styled checkbox directive for angular app

  11. 11

    Angular Directive 요소 문제

  12. 12

    Is one of these the more "Angular" way of communicating with a directive?

  13. 13

    Angular.js directive isolated scope not working

  14. 14

    Angular Directive 부모 템플릿?

  15. 15

    angular leaflet directive:: check if point is in polygon

  16. 16

    Angular.js directive isolated scope not working

  17. 17

    Creating custom angular directive for term.js

  18. 18

    Use an Angular directive to generate html from an array

  19. 19

    angular directive - scope undefined inside function

  20. 20

    angular directive ng-repeat scope and Service

  21. 21

    Angular ngrepeat multiple items in an array using directive

  22. 22

    Change src img directive or filter angular

  23. 23

    Define a function for ng-click in an Angular directive

  24. 24

    Angular directive link function never runs

  25. 25

    Reload directive method after POST in Angular JS

  26. 26

    JQuery not detecting DOM elements inside angular directive

  27. 27

    Confirm password custom directive is not working in Angular

  28. 28

    Angular, nested directive repeats, pass if parent is $last

  29. 29

    Angular.js call jquery function in Directive

뜨겁다태그

보관