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

When using svg directive(wrapped in another svg element) with ngRepeat, the newly added element is not replaced with the directive template #9344

Closed
merlinchen opened this issue Sep 30, 2014 · 1 comment

Comments

@merlinchen
Copy link

If the svg directive is wrapped in another svg element like this:

<g ng-repeat="rect in rects">
    <my-rect index=$index></my-rect>  
</g>

The newly added element is not replaced with the directive template. Only happens when the template is loaded from a separate file. Maybe related to #8808
http://plnkr.co/edit/ZFBWiLMP4uTF67rkf2ou?p=preview

@caitp caitp added this to the 1.3.0 milestone Oct 3, 2014
@tbosch tbosch self-assigned this Oct 3, 2014
tbosch added a commit to tbosch/angular.js that referenced this issue Oct 3, 2014
This fixes the case when a directive that uses `templateUrl`
is used somewhere in the children 
of a transcluding directive like `ng-repeat`.

Fixes angular#9344
Related to angular#8808
@tbosch
Copy link
Contributor

tbosch commented Oct 3, 2014

We had multiple versions to this place in the compiler:

  1. Initially we thought we could cache the namespace adapter $compileNodes.
  2. Then we had the usecase where the root of the $compileNodes was a template directive with a template that is fetched slowly. So we added a check whether the content of the $compileNodes jqLite wrapper was changed to clear the cache (see When using svg directive with ngRepeat, the newly added element is not replaced with the directive template #8808 and cb73a37).
  3. Now we have the usecase where a child element of the $compileNodes is a template directive with a template that is fetched slowly. Right now there is no way to detect that there is a template load pending, so we need to clone the $compileNodes in every call to the linking function if the namespace is svg.

In summary:
We cannot cache the namespace adapted $compileNodes at all.

@tbosch tbosch closed this as completed in f3539f3 Oct 3, 2014
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.