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

directive template vs. templateUrl #1166

Closed
realdope opened this issue Jul 19, 2012 · 1 comment
Closed

directive template vs. templateUrl #1166

realdope opened this issue Jul 19, 2012 · 1 comment

Comments

@realdope
Copy link

I have an example with 2 directives defined. One of them has an anchor, when clicked, inserts the other directive as DOM elements onto the page.

http://jsfiddle.net/realdope/cvzWJ/13

In the above code, "elem" is the element to be inserted into the page. Initially both elements are placed on the page to show that they initially render properly.

When I define "template" instead of "templateUrl" in the "elem" directive definition, everything works perfectly. However, when I use a templateUrl with <script type="text/ng-template">, initial rendering works fine, but event-initiated rendering does not work.

The problem is better demonstrated by using a .html file.

@ProLoser
Copy link
Contributor

Adding another example http://plunker.no.de/edit/ubOEqt?live=preview

IgorMinar added a commit to IgorMinar/angular.js that referenced this issue Oct 25, 2012
This fixes the issue that caused two attr interpolation observers
to be registered for the same attribute as a result of isolate
scope definition with attr (@) property for this attribute.

Duplicate observers would then fight with each other updating the
model.

The issue occured only when this directive was used in a repeater
because that's when we clone the template node which caused the
two observers to point to two different sets of $attr instances.

Closes angular#1166, angular#836
IgorMinar added a commit that referenced this issue Oct 30, 2012
This fixes the issue that caused two attr interpolation observers
to be registered for the same attribute as a result of isolate
scope definition with attr (@) property for this attribute.

Duplicate observers would then fight with each other updating the
model.

The issue occured only when this directive was used in a repeater
because that's when we clone the template node which caused the
two observers to point to two different sets of $attr instances.

Closes #1166, #836
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants