I need to be able to access the current element of ng-repeat inside a directive. See the jsfiddle for this:
http://jsfiddle.net/terebentina/TVEnN/
I am expecting a hash in the console (like {width: 100, height: 100}) but I am not really sure how to do that.
Any help would be much appreciated.
Here is a fiddle that works ( and outputs what you are expecting).
http://jsfiddle.net/TVEnN/2/
Things to Note about
ng-repeat:ng-repeatalways creates a NEW SCOPE for each element in the array / object.ng-repeat. For ex: if you definedng-repeat = "page in pages"then the current element is available in the scope as page. If you definedng-repeat = "(key,value) in object"bothkeyandvalueare available in this new scope.$index.ng-repeatcreates a new scope and all scopes inherit from their parent thepagesin the above example is still available in this new scope, which means you could do stuff like$scope.pages.lengthif you need to.