我怎樣才能得到一個圖片ID我的控制器內而選擇圖像上我怎樣才能得到圖片ID我的控制器內,而在angularjs
我的HTML文件
<ul class="thumbnails">
<li class="span3" ng-repeat="reward in rewardData.results">
<a class="thumbnail" href="#">
<img src="data:image/png;base64,{{reward.image}}" />
</a>
</li>
</ul>
<div style="display:block;width:60%;">
<a href="#invite" class="btn btn-theme invitefr" ng-click="selectPrizes()"> Save Challenge and Continue</a>
</div>
它會選擇圖像上顯示多個圖像,我想要一個圖像ID在我的控制器內,而一些人選擇任何圖像,任何人都可以知道如何實現它?
我的控制器:
app.controller("PrizesController", ["$location", "$scope","authenticationSvc","$http", function ($location, $scope,authenticationSvc, $http) {
console.log("inside prize controller");
var token = authenticationSvc.getUserInfo();
var config = {
headers: {
'h5cAuthToken': token.accessToken,
'Accept': 'application/json;odata=verbose'
}
};
$http.get("http://IPandPortnumber/ccp-services/challengereward/allRewards", config)
.then(function (response) {
$scope.rewardData = response.data;
});
$scope.selectPrizes = function() {
// some block of codes
$location.path("/invite");
}
}]);
裏面有元素名爲id或獎勵數據數組 –
@Ranawaka,獎勵裏面獎勵數據 –
@ ashishkumar-是否有唯一的圖像編號? – Maheshvirus