angular - ng-if - how to callback after ng-if template has been rendered

前端 未结 4 1231
再見小時候
再見小時候 2021-02-18 18:47

in Angular, I need to call a function after an element with certain class has been loaded. Display of the element is controlled via ng-if=\'expr\'. Value of $scope.expr is set a

4条回答
  •  清酒与你
    2021-02-18 19:12

    One possible answer would be to create a directive that does whatever you want to do. If you then use that directive only within the section of HTML controlled by the ng-if, then the directive will be dormant until the ng-if expression is true.

    Would that do what you want?

提交回复
热议问题