获取ng-repeat

时间:2015-08-17 01:27:16

标签: angularjs

有没有办法获得关键'在范围内的ng-repeat。$ watch

<div ng-repeat="(key, contents_extended_data) in moderation.contents">
   <img src="" id='target_photo_[[contents_extended_data.reference]]'>
</div>

// I can't find any variable that can get the value of the key in Angular documentation
scope.$watch('$index',function(v){
    // do something here using the id of the image
    $('#target_photo_' + v)
});

提前致谢

0 个答案:

没有答案