-
Notifications
You must be signed in to change notification settings - Fork 27.5k
ng-repeat should not leave junk directive fragments in the DOM #4930
Comments
it's not clear from the description of this error, but it does appear that we are adding extra nodes with no content to the repeated elements. looks like an off by one error of some sort (maybe in block scanning algorithm). I was able to repro this with v1.2.1 See screenshot with the extra node highlighted: |
Looking into this now. |
Minimal case to reproduce: element that has a |
Here is the line that is causing this: https://github.com/angular/angular.js/blob/master/src/ng/compile.js#L1704 |
So the real problem is this:
Here is a test without
|
So there are the two places that need to be fixed:
I don't understand the logic behind the |
…he cloning If an element has a directive whose content is loaded using `templateUrl`, and the element is cloned using a linking function before the template arrives, the clone needs to be updated as well. This also updates `ngIf` and `ngRepeat` to keep the connection to the clone of a tranclude function, so that they know about the changes a directive with `templateUrl` does to the element in the future. Fixes to angular#4930.
Closed via b0972a2 |
…he cloning If an element has a directive whose content is loaded using `templateUrl`, and the element is cloned using a linking function before the template arrives, the clone needs to be updated as well. This also updates `ngIf` and `ngRepeat` to keep the connection to the clone of a tranclude function, so that they know about the changes a directive with `templateUrl` does to the element in the future. Fixes to angular#4930.
…he cloning If an element has a directive whose content is loaded using `templateUrl`, and the element is cloned using a linking function before the template arrives, the clone needs to be updated as well. This also updates `ngIf` and `ngRepeat` to keep the connection to the clone of a tranclude function, so that they know about the changes a directive with `templateUrl` does to the element in the future. Fixes to angular#4930.
Demonstrating the problem - http://plnkr.co/edit/GBuCj8uQkpm0H5yG3nGk?p=preview
Note that the directive HTML fragments are left in the DOM although on screen the directives appear as expected, although sometimes the order of the directives is mixed up. You can use your DOM inspector to see the junk directive fragments.
Delaying the application to scope of the initial array using a timeout results in expected behaviour in the DOM and on screen. Use of resolve in a route does not solve the problem.
The implications for the former problem are that classes are not applied correctly and order is not consistent.
The text was updated successfully, but these errors were encountered: