0

The Problem

The directive is not initializing properly when the child directive is have a ng-repeat.

Go to the plunker and check the console. The working one have the outer - link at the end of the console, the not working one have the outer - link function init with the controller.

The working Plunker without ng-repeat

<div outer-directive>
    <div inner-directive>

    </div>
</div>

Console

outer - controller
inner - controller
inner - Link
outer - Link

The not working Plunker with ng-repeat

<div outer-directive>
  <div inner-directive ng-repeat="value in [1]">

  </div>
</div>

Console

outer - controller
outer - Link
inner - controller
inner - Link
Lukas Chen
  • 373
  • 7
  • 15
  • inner directive DOM get rendered later because of `ng-repeat`..that why you are not getting the expected call stack in `console.log`, you need to wait till last digest cycle complete in inner directive(refer [this answer](http://stackoverflow.com/a/13472605/2435473)).. – Pankaj Parkar Apr 30 '16 at 13:56
  • But then how to init parent link function after child finish ng-repeat (The child directive need's parent directive's controller). – Lukas Chen Apr 30 '16 at 14:14

0 Answers0