Wheel Tire Family Wheel Tire Family - 1 year ago 74
AngularJS Question

AngularJS and Edmunds Media API to pull vehicle images

Situation: Using a Rails app, and $http.get in AngularJS to PULL the photos from Edmunds.com MEDIA API.

TASK TRYING TO COMPLETE: ng-repeat through the vehicle photos.

CONDITIONS: I am getting the response successfully and able to load one image, but how can I have it repeat through the photos array and do all the images.

Apologies for unclear explanation, and any help appreciated.


<h1> Wheel Tire Family </h1>
<!-- CAR IMAGES -->
<div ng-init="carImages">

<img src="https://media.ed.edmunds-media.com/{{carImages}}">



$scope.photos = {};
$scope.carImages = {};

//GET the edmunds media api for the
//Make Model Year photos

.success(function (data) {
var photos = data;
$scope.carImages = photos.photos[0].sources[0].link.href;

Answer Source

Maybe something like this?


.success(function (data) {
    $scope.carImages = data.photos;


<div ng-repeat="carImage in carImages">
    <img ng-src="https://media.ed.edmunds-media.com/{{carImage.sources[0].link.href}}">

This should loop through the images and pick the first "source" link. It is also recommended that you use ng-src instead of src.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download