Javascript ng重复图像是否未显示?

Javascript ng重复图像是否未显示?,javascript,angularjs,Javascript,Angularjs,我在cloudinary中存储了图标。在这里,我使用ng repeat列出了所有可以工作的商店,但没有显示图标。我附上了我的html和控制器代码。我有这样的图标******/icon1.png 角度模块('test',[]) .controller('TestController',['$scope','$filter','$http', 函数($scope、$filter、$http){ $http.get('**').success(函数(数据、经销商、响应){ $scope.dealer

我在cloudinary中存储了图标。在这里,我使用ng repeat列出了所有可以工作的商店,但没有显示图标。我附上了我的html和控制器代码。我有这样的图标******/icon1.png

角度模块('test',[]) .controller('TestController',['$scope','$filter','$http', 函数($scope、$filter、$http){ $http.get('**').success(函数(数据、经销商、响应){ $scope.dealers=数据; console.log(数据图标); }); }]); //控制台我得到这样的图标 "http://res.cloudinary.com/*******/icon1.png,http://res.cloudinary.com/icon2.png,http://res.cloudinary.com/icon3.png“

您提到:

//console i am getting icons like this    "http://res.cloudinary.com/*******/icon1.png,http://res.cloudinary.com/icon2.png,http://res.cloudinary.com/icon3.png"
这是一根绳子。并且不能对字符串进行迭代。您需要将其转换为数组,然后对其进行迭代

使用
split(“,”)
将字符串转换为数组

更改此行:

$scope.dealers = data;
致:

旁注:

Img是一个自动关闭标签。将其更正为:

<img src="" />

您提到:

//console i am getting icons like this    "http://res.cloudinary.com/*******/icon1.png,http://res.cloudinary.com/icon2.png,http://res.cloudinary.com/icon3.png"
这是一根绳子。并且不能对字符串进行迭代。您需要将其转换为数组,然后对其进行迭代

使用
split(“,”)
将字符串转换为数组

更改此行:

$scope.dealers = data;
致:

旁注:

Img是一个自动关闭标签。将其更正为:

<img src="" />

您需要先将data.icon转换为数组:

$scope.dealers = data.icons.split(',');
然后:

<div class="list card" data-ng-repeat="dealer in dealers | filter:query">
  <img ng-src="dealer"/>
</div>

您需要先将data.icon转换为数组:

$scope.dealers = data.icons.split(',');
然后:

<div class="list card" data-ng-repeat="dealer in dealers | filter:query">
  <img ng-src="dealer"/>
</div>


经销商图标的类型是什么?是数组还是字符串?字符串我得到了******/icon1.png,是的。此字符串不是有效的URI。你应该像K在他们的回答中所说的那样解析它。
dealer.icons的类型是什么?是数组还是字符串?字符串我得到了******/icon1.png,是的。此字符串不是有效的URI。你应该像K在他们的回答中所说的那样解析它,这意味着你应该有一个可以迭代的数据。无法迭代字符串,因为它没有任何子项。一个数组,对象有子项,因此可以被迭代。这意味着你应该有一个可以被迭代的数据。无法迭代字符串,因为它没有任何子项。在数组中,对象具有子项,因此可以迭代。