![](/img/trans.png)
[英]Hide sidebar for particular page in Mobile Angular Ui.(Angular Js)
[英]Not retrieve image from JSON in Mobile Angular Ui.(Angular Js)
我想从JSON检索图像。 现在,我正在从JSON中检索所有这些东西,例如价格,显示顺序,但无法检索图像。
HTML:
<div ng-controller="chooseProductDescription">
<div ng-repeat="cat in productDescription">
<img src="{{cat.product.productPictures[0].pictureUrl}}">
<span>Price</span>{{cat.product.price}}
<span>Display Order</span>{{cat.product.productPictures[0].displayOrder}}
</div>
</div>
控制器:
.controller('chooseProductDescription', function($scope, $http){
$http({
method:'get',
url:'http://www.json-generator.com/api/json/get/cgrvadFrGW?indent=2',
header:{'Content-Type':'application/json'},
}).success(function(data,status,headers, config){
$scope.productDescription = data;
alert("shjkshjksadhkjas");
}).error(function(data, status,headers, config){
})
})
现在,我正在从以下URL检索数据:
http://www.json-generator.com/api/json/get/cgrvadFrGW?indent=2
我想从json检索图像。 请分享您的想法。
您在$ http承诺的响应中使用的格式不正确。 该代码应为:
$http({
method:'get',
url:'http://www.json-generator.com/api/json/get/cgrvadFrGW?indent=2',
header:{'Content-Type':'application/json'},
}).success(function(response){
$scope.productDescription = response.data;
alert("shjkshjksadhkjas");
}).error(function(response){
})
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.