AngularJS-如何显示$http JSON行中的颜色

AngularJS-如何显示$http JSON行中的颜色,angularjs,json,Angularjs,Json,大家好,我需要帮助显示产品的颜色和图像在html使用AngularJS。获取的数据与$http服务一起用作JSON数据。 这是模板应该是什么样子的示例 //Produit Couleurs控制器 specApp.controller(“produit\u coulers\u imagesController”[“$scope”,“$http”,函数($scope,$http){ $scope.error\u message=函数(响应){ $scope.produit_couleurs_imag

大家好,我需要帮助显示产品的颜色和图像在html使用AngularJS。获取的数据与$http服务一起用作JSON数据。 这是模板应该是什么样子的示例

//Produit Couleurs控制器
specApp.controller(“produit\u coulers\u imagesController”[“$scope”,“$http”,函数($scope,$http){
$scope.error\u message=函数(响应){
$scope.produit_couleurs_images_error=“status:”+response.status+”|状态文本:“+response.statusText;
}
$http.get(“php/json/produit\u couleurs\u images.php”)。然后(
功能(响应){
if(response.data.produit\u couleurs\u images){
$scope.produit\u couleurs\u images=response.data.produit\u couleurs\u images;
}否则{
$scope.error_消息(响应);
}
},
功能(响应){
$scope.error_消息(响应);
}
);
}]);


GET应该会返回一些属性,告诉JS实际颜色是什么是?像十六进制字符串或rgb一样?
$scope.produit\u couleurs\u images
的预期值是多少?它是否包含url或十六进制?您好,这是json数据产品图片:[0:{id:“1”,颜色:“…”,图片缩略图链接:“…”,正面链接:“…”},1:{id:“2”,颜色:“…”,图片缩略图链接:“…”,正面链接:“}]和颜色是字符串类型,但不是英语,将它们修改为rgb不是更好吗???这不是创建数组的正确方法
[0:{},1:{}]
的响应是对象
{0:{image…},1;{image…}
无论如何,您可以从模板访问
$scope.produit\u couleurs\u images
{code>{produit\u couleurs\u images},我知道,但是我已经很喜欢颜色的展示了,但是我想在点击ngClick的颜色链接时返回颜色id,然后更新图片,任何人都可以帮我!!!