Say I have this div in a sentence ng-repeat:
<div ng-repeat="item in list" class="myDiv" ng-click="doStuff(item)">
{{item.title}}
</div>
And it is based on this model:
$scope.list = [
{ 'title': 'Item 1', 'someData': 'lalala' },
{ 'title': 'Item 2', 'someData': '666' },
{ 'title': 'Item 3', 'someData': 'qwerty' }
];
Then I get 3 repeated divs.
Now I have an external script to analyze the page, and I want to extract data from these elements. So, for example, if I select the first div var div1 = $('div.myDiv:first'), I can get the attributes ng-clickand from it ng-repeat. I can also use angular.element(div1).data('$binding')to get the binding {{item.title}}.
But what I really want is the individual element data of this particular div: I want to write a function getItemData(element)that will receive div1and return { 'title': 'Item 1', 'someData': 'lalala' }.
?
, , , . , .