我正在尝试通过ng-click函数将完整的重复对象数据作为参数。
喜欢:
getImages($index,award)
"{
"piaKey": 3, "etc": "etc.."
}"
html
<div ng-repeat="award in awards track by $index">
<span class="col-lg-1 col-md-1">{{$index+1}}.</span>
<div id="award-{{$index+1}}" class="col-lg-11 col-md-11 mb10 pad0 listViewInner">
<div class="infoHead">{{award.piaAwardName}}
</div>
<div class="infoAdditional">{{award.piaDescription}}
</div>
<div class="popViewUploadBtns">
<button class="btn btn-primary" ng-click="getImages($index,award)" type="button">
<span class="fa fa-photo"></span>View Photos
</button>
</div>
</div>
</div>
JS
tacteddata 是不确定的
$scope.getImages = function(index,attachData){
$http.get('localhost:8082/wasta/fileRetrieve?referenceKey='+attachData.piaKey+'&referenceType='+attachData.piaType+'&fileType='+attachData.piaFileType).
success(function(data, status, headers, config) {
$scope.attachedPhoto = data;
})
}
如果我像这样通过 getimages($ index,dawar.piakey),我将像" 3" 完美地获取数据,其中为我没有获取全部数据。我在这里试图获得
tacteddata 喜欢:" {" {" Piakey":3,"等等:":"等等。 将附加Data更改为数据 演示链接https://plnkr.co/edit/lmi4bnsugaetopw5kosa?p=preview $scope.getImages = function(index,data){
--**change**--------------------------^
$http.get('localhost:8082/wasta/fileRetrieve?referenceKey='+data.piaKey+'/referenceType='+data.piaType+'/fileType='+data.piaFileType).
success(function(data, status, headers, config) {
$scope.attachedPhoto = data;
})
}