AngularJS : Directive not able to access isolate scope objects

后端 未结 2 515
谎友^
谎友^ 2021-01-02 07:30

I am trying to put some default values in my directive with Isolate scope. Basically, I need to do some DOM manipulations using the scope object when my directive is bound.

2条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2021-01-02 08:17

    Most likely the isolated scope variable is not available when the directive's controller first instantiates but probably its available when you need it for a following event such as: within a function bound to an ng-click

    its just a race condition and the object doesn't arrive exactly when directive's controller loads

提交回复
热议问题