Use AngularJS Variable, where another AngularJS Variable matches its ID -
i have ng-repeat
statement want show image. image however, should chosen ng-repeat's id matches image object's id.
i unsure of how properly, here psuedo code of trying do.
<tr ng-repeat="user in rosterdata | orderby:'name'"> <img ng-src="{{champion.imagename user.id = champion.id}} /> </tr>
remember champion.id
object of champions, want make sure right champion.name
match right champion.id
when matches current ng-repeat user.id
it better if check logic inside controller:
<tr ng-repeat="user in rosterdata | orderby:'name'"> <img ng-src="{{getimage(user.id)}} /> </tr>
in controller:
$scope.getimage = function(userid) { var image = "defaultimage"; $scope.champions.foreach(function(champion) { if(champion.id===userid) { image = champion.image; } }); return image; }
Comments
Post a Comment