You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Apr 12, 2024. It is now read-only.
i've been porting my application to 1.2.rc1 and I've noticed that the behavior of the link function on directives using ng-transclude has changed, and it is now reversed (parent are linked before children). The real problem, however, is that the DOM element received in parent link function is empty, which makes any DOM manipulation useless (like applying a jQuery plugin).
I've created two fiddles: the first uses 1.1.5 (http://jsfiddle.net/NXwu5/), and in the console you can see that the child link function is called first and the parent second, and in both cases the element received is complete (its children property is non empty); the second uses 1.2.rc1 (http://jsfiddle.net/PkTLj/1/), and in this case the parent link function is called before the child and, more importantly, the element received is empty.
I've looked at the changelog and to previous bug reports, and if fact one of the changes seems to be related to this problem ("always instantiate controllers in parent->child order (45f9f62, #2738)"). Moreover, an older bug seems also to be related (Issue #1567), although changing the replace attribute does not seems to fix the issue.
So far I've been able to solve the problem by manually transcluding (http://jsfiddle.net/PkTLj/4/ ): the order of invocation is still reversed but, as i'm transcluding myself, I'm able to activate my jQuery plugin when the element children have been added. Notice, however, that the element is still incomplete: as the order of the link functions is still reverted, I get access only to the parent children, not to the grandchildren (which, my plugin fortunately does not need).
I don't know if this was intended, or if I'm not understanding correctly the transclusion thing, but I believe the new behavior breaks the promise that the link function is fine for DOM manipulation (i've tried using pre- and post- linking functions with the same result).
Any idea on what I might be doing wrong?
Thanks,
R.
The text was updated successfully, but these errors were encountered:
Hello,
i've been porting my application to 1.2.rc1 and I've noticed that the behavior of the link function on directives using ng-transclude has changed, and it is now reversed (parent are linked before children). The real problem, however, is that the DOM element received in parent link function is empty, which makes any DOM manipulation useless (like applying a jQuery plugin).
I've created two fiddles: the first uses 1.1.5 (http://jsfiddle.net/NXwu5/), and in the console you can see that the child link function is called first and the parent second, and in both cases the element received is complete (its children property is non empty); the second uses 1.2.rc1 (http://jsfiddle.net/PkTLj/1/), and in this case the parent link function is called before the child and, more importantly, the element received is empty.
I've looked at the changelog and to previous bug reports, and if fact one of the changes seems to be related to this problem ("always instantiate controllers in parent->child order (45f9f62, #2738)"). Moreover, an older bug seems also to be related (Issue #1567), although changing the replace attribute does not seems to fix the issue.
So far I've been able to solve the problem by manually transcluding (http://jsfiddle.net/PkTLj/4/ ): the order of invocation is still reversed but, as i'm transcluding myself, I'm able to activate my jQuery plugin when the element children have been added. Notice, however, that the element is still incomplete: as the order of the link functions is still reverted, I get access only to the parent children, not to the grandchildren (which, my plugin fortunately does not need).
I don't know if this was intended, or if I'm not understanding correctly the transclusion thing, but I believe the new behavior breaks the promise that the link function is fine for DOM manipulation (i've tried using pre- and post- linking functions with the same result).
Any idea on what I might be doing wrong?
Thanks,
R.
The text was updated successfully, but these errors were encountered: