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

Different DOM when using template vs templateUrl with replace true #10612

Closed
kopatsy opened this issue Dec 31, 2014 · 5 comments
Closed

Different DOM when using template vs templateUrl with replace true #10612

kopatsy opened this issue Dec 31, 2014 · 5 comments

Comments

@kopatsy
Copy link

kopatsy commented Dec 31, 2014

When repeating a directive with replace=true and a templateUrl, all the elements of the repeated directives end up in the last repetition.

The only difference between the two plnkr's below is that the first one is using templateUrl while the second one is using an inlined template. The rendering is however different.

With templateUrl (broken): http://plnkr.co/edit/c7jZSldkkQxzjNRZHcPZ
With template (working): http://plnkr.co/edit/aMm6eReAZ4C5WgrsMddD

@kopatsy
Copy link
Author

kopatsy commented Jan 1, 2015

Unit test reproducing the issue: https://gist.github.com/kopatsy/a9083762cc8cf479b2d6

@neberej
Copy link

neberej commented Jan 2, 2015

I have faced similar issues on past. Wrapping ng-repeat element with div fixes it. Though I cant explain why.

@lgalfaso
Copy link
Contributor

lgalfaso commented Jan 3, 2015

there are a few previously reported issues on different variations of this. The main issue is that when replace=true and there is a directive at the top level of the directive that specifies replace=true or transclude=element, then the compilation runs into this issue. It is not a simple problem to solve, but it falls into the small variations that are present between the use of template and templateUrl that in many cases, just like this, are very hard to solve

@Narretz
Copy link
Contributor

Narretz commented Jan 6, 2015

So, the question is if we intend to fix these or simply document these edge cases

@Narretz Narretz modified the milestones: Backlog, Ice Box Mar 8, 2015
@Narretz Narretz modified the milestones: Ice Box, Backlog Nov 10, 2015
@Narretz
Copy link
Contributor

Narretz commented Apr 6, 2018

Duplicate of #14326

@Narretz Narretz marked this as a duplicate of #14326 Apr 6, 2018
@Narretz Narretz closed this as completed Apr 6, 2018
Narretz added a commit that referenced this issue Apr 9, 2018
Narretz added a commit that referenced this issue Apr 11, 2018
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

4 participants