Capture image by url

5

I have the following url:

link {{name}} .png

Replacing the word nome with a specific name and navigating to the page in question shows an image.png. How can I capture this image using angularjs?

Ex: link

    
asked by anonymous 18.02.2016 / 19:29

1 answer

3

Using ng-src . Following example:

var app = angular.module('sampleApp', []);

app.controller('SampleController', function ($scope, $http) {

$scope.codigos = ['Nautilus','Azir','Ekko'];
  
});
<script src="//cdnjs.cloudflare.com/ajax/libs/angular.js/1.4.9/angular.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/angular.js/1.4.9/angular-resource.js"></script>
<div ng-app="sampleApp">

  <div ng-controller="SampleController">
    
    <img ng-src='http://ddragon.leagueoflegends.com/cdn/6.3.1/img/champion/{{i}}.png' ng-repeat='i in codigos'/>

  </div>
</div>
    
18.02.2016 / 19:36