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

Interpolated values aren't reflected when using templateUrl #836

Closed
ghost opened this issue Mar 28, 2012 · 6 comments
Closed

Interpolated values aren't reflected when using templateUrl #836

ghost opened this issue Mar 28, 2012 · 6 comments
Assignees

Comments

@ghost
Copy link

ghost commented Mar 28, 2012

In the following fiddle, when using templateUrl, {{authorized}} isn't being reflected properly, but switching to an inline template it is reflected properly. Workaround is here, provided by votja: http://jsfiddle.net/vojtajina/CHVbb/302/

@ghost ghost assigned mhevery Apr 13, 2012
@IgorMinar
Copy link
Contributor

Misko can you have a look at this.

you can repro the issue here: http://jsfiddle.net/CHVbb/367/

@mhevery
Copy link
Contributor

mhevery commented Apr 13, 2012

I have wasted 30 minutes on this issue, and still have no clue what is it you think does not work

PLEASE!!!!

  1. Give steps to reproduce it.
  2. Clearly state at each step what is the expected behavior, and what actually happens.

@ghost
Copy link
Author

ghost commented Apr 14, 2012

I was in a bit of a hurry for the last fiddle, took some time and cleaned it up to be more direct, this should be much easier to see what the actual problem is, which is when using templateUrl in a directive, observing the bound attributes from within the link method doesn't seem to be working. Switching to use an inline template though, and it does work. Here's the fiddle, preset to show the problem, but also with a commented out template so you can see the difference:

http://jsfiddle.net/CHVbb/379/

@qualidafial
Copy link

I've reproduced the problem in this fiddle: http://jsfiddle.net/bQSQt/5/

Inside an ng-repeat, a directive using templateUrl will fail to interpolate attributes values when rendering the template.

Edit: updated fiddle to template and templateUrl contents match

@petebacondarwin
Copy link
Contributor

This appears to be a similar problem... The @ scoped values are not being interpolated if using templateUrl.

Fiddle showing the broken behavior: http://jsfiddle.net/Kpd89/
Fiddle showing correct behavior: http://jsfiddle.net/AdD5T/

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
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
@pkozlowski-opensource
Copy link
Member

Fixed in 1.0.3, yuppi :-)
http://jsfiddle.net/Kpd89/1/

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

5 participants