Hi All,
I have used directive based approach in an AngularJS application . I have one parent container in which all the directives are displayed depending upon certain conditions.
On the parent container there is one directive of type attribute i.e. my-directive , which is used for traversing the whole of the DOM. i.e. adding a certain class to the child elements.
Now what is happening when initially page loads some of the child directives inside the parent container are still to be compiled , up till then my-directive tarverse all the way thriugh DOM & add class to
children as a result some child directives are missed of traversing . I have already placed the traverse() function inside the post link of my-directive (i.e considering the post link works bottom up) ,
but still traverse() function executes even if few directives are yet to be compiled. For time being i have called traverse() inside $timeout with some delay. I don't think using delay is proper way as some times it may break if some directives takes more time. So can you all please suggest what should be done in this case.
Thanks