Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

ng-include regression not fully fixed by #5247 #6898

Open
hippotz opened this issue Mar 28, 2014 · 4 comments
Open

ng-include regression not fully fixed by #5247 #6898

hippotz opened this issue Mar 28, 2014 · 4 comments

Comments

@hippotz
Copy link

hippotz commented Mar 28, 2014

If I have a terminal directive on the same element as ng-include I cannot get access to element when linking occurs inside my directive.

In angular 1.2.1 -> 1.2.2 there was a regression with ng-include that caused this problem for all directives.
#5247 fixed the problem for directives with terminal: false

It is still a problem for directives with terminal: true.

example:
http://plnkr.co/edit/ehqS2VOFTvPLt5Z7iXs1

@Narretz Narretz added this to the Backlog milestone Jul 2, 2014
@btford btford removed the gh: issue label Aug 20, 2014
@tbosch tbosch modified the milestones: 1.3.0-rc.3, Backlog Sep 15, 2014
@jeffbcross jeffbcross modified the milestones: 1.3.0-rc.3, 1.3.0-rc.4 Sep 22, 2014
@petebacondarwin
Copy link
Contributor

I spend a little time today looking at this issue and I haven't come up with a good solution yet.

@IgorMinar
Copy link
Contributor

this is because the content for ngInclude is filled via ngIncludeFillContentDirective: https://github.com/angular/angular.js/blob/master/src/ng/directive/ngInclude.js#L267-L295

this directive has priority -400 which means that it doesn't run because of the terminal directive.

since this issue affects only ngInclude and not $compile I'm ok to push this out to be fixed post 1.3.0

@IgorMinar IgorMinar modified the milestones: Backlog, 1.3.0-rc.4 Sep 30, 2014
@petebacondarwin
Copy link
Contributor

@IgorMinar & @tbosch - It worries me that ngInclude creates its own scope to be used for the transcluded content. This means that nested transclusion could be broken when ngInclude is involved. Really, what these issues are highlighting is that there is a case for support in $compile of a different kind of "container" directive that effectively provides its content (and collocated lower priority directives) to its template and link function in such a way that we can control how and when this content is compiled.

I believe this can be achieved with a lot of boilerplate code in the ngInclude function by converting it back to a teminal directive and then manually collecting up its contents and lower priority directives into some form that can then be compiled at the correct time in such a way that these lower priority directives effectively appear on the included content, with the content already in place. But this would be a right pain to implement every time and it would be better if it was moved into $compile...

@petebacondarwin petebacondarwin modified the milestones: Ice Box, Backlog Jul 30, 2015
@petebacondarwin
Copy link
Contributor

This seems like an uncommon corner case. I don't think we are going to get round to fixing it in the near future. Assigning to the Ice Box for now.

@petebacondarwin petebacondarwin removed their assignment Jul 30, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

7 participants