-
Notifications
You must be signed in to change notification settings - Fork 27.4k
AngularJS 1.5 directive link execution order #13884
Comments
Doesn't look like it: http://plnkr.co/edit/QKlsLNyr0RrECqeSDDRc?p=preview It's possible that because of lazy transclusion you're seeing something diffeent. We'll need a demo of that though. |
I think this issue may be related to something I ran into with a project that I am working on. I had this same question about the link execution order when moving from Angular 1.4.8 to 1.5.0-rc.2. I want to post a few Plunkers to demonstrate what is happening but I want to also express that this does not appear to be a bug with Angular. This ends up falling into an unspecified behavioral case rather than being a bug between 1.4.8 and 1.5.0. Thanks to @dcherman for going through the Angular code with me to determine if it was related to a change he made in 1.5.0-beta.1. This first Plunker shows that the link order is correctly bottom up in Angular 1.4.8. The Next, I will introduce an async template via the If we add an In this last example, we see that the behavior in Angular 1.5.0-rc.2 looks to have changed when directives are wrapped in an ng-repeat but this is due to the way transcluded directives process async templates. Now that 1.5.0 lazily compiles transcluded content, it can cause directives with templateUrl to link in a different order than bottom-up since that eager compilation was altered. Lastly, the fix for my application, since I am using Gulp and Hopefully everyone made it to the end of my lengthy description. @alangria - I am not sure if you were experiencing this with regards to a transcluded directive like |
+1, thanks @mragentman for your post. |
There should be something about this in the release notes as this breaks animations on a trivial case (when not to be fixed). Better yet, do not allow for lazy compilation when templateUrl is not cached yet. Easy to say, I know. ;) https://plnkr.co/edit/okAirW34LQ8uCYzR7Ijf?p=preview see: #14074 |
After reading this commit I think we should be able to opt-out of this behaviour 652b83e |
Reverse the order that an event is triggered so the autocomplete directive can work correctly with Angular 1.5, since the order that child directives are compiled has been changed in that version of the framework, due to lazy transclusion (see angular/angular.js#13884 and angular/angular.js@652b83e). Closes #638
Hello,
Does AngularJS 1.5 change the directive link execution order?
Suppose that you have
In 1.4.8 the execution would be
in 1.5.0 the execution of ParentDirective's postlink was done before ChildDirective's postlink
The text was updated successfully, but these errors were encountered: