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

directive attribute evaluation in ng-repeat #1103

Closed
leefernandes opened this issue Jun 29, 2012 · 8 comments
Closed

directive attribute evaluation in ng-repeat #1103

leefernandes opened this issue Jun 29, 2012 · 8 comments

Comments

@leefernandes
Copy link
Contributor

directive attributes don't seem to be evaluating properly inside of ng-repeat, but are ok outside of it.

http://jsfiddle.net/ItsLeeOwen/UYkJP/

@leefernandes
Copy link
Contributor Author

I'm using a linking function as a workaround. A regex loop looks for any unevaluated "{{ stuff }}" and uses $parent.$eval to evaluate and $digest.

http://jsfiddle.net/ItsLeeOwen/vBEmE/

@mkotsur
Copy link
Contributor

mkotsur commented Jun 30, 2012

Having the same problem. Will look into the code.

@mkotsur
Copy link
Contributor

mkotsur commented Jun 30, 2012

If you add item to the list on the fly, like via console, or on some action, ngRepeat will pass this item to directive without any problems. It means that at the time when linking is executed for the custom directive first time, scope doesn't contain needed value yet. Probably because custom directive is linked before ngRepeat.

@leefernandes
Copy link
Contributor Author

Peter Bacon Darwin discovered that using template instead of templateUrl for the directive is a workaround.

http://jsfiddle.net/5P36t/

@pkozlowski-opensource
Copy link
Member

@itsleeowen It was already fixed in master (#1494), here is the working jsFiddle with the latest AngularJS build (from master, not released yet): http://jsfiddle.net/Jnnvp/1/

Closing as duplicate of #1166 and the #1104 that you've opened as well.

@mvanlonden
Copy link

Ran into the same problem with the template vs templateUri issue. Cost me a couple hours because the issues don't seem to be related. The solution jsfiddle seems to be broken as well.

Minor issue for how powerful the framework is, just stumped me for a bit.

@Narretz
Copy link
Contributor

Narretz commented Jul 18, 2014

@mvanlonden
Are you using an old angular version? The fiddle didn't work because it points to the latest snapshot on master and the syntax for registering controllers has changed: http://jsfiddle.net/Jnnvp/20/

@mvanlonden
Copy link

Yes I was using an older version. My apologies

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