[英]How to show values in html coming from object consistently?
My html : 我的html:
<p ng-repeat="gg in john(z.items)">Item:{{gg.name}} Quantity:{{gg.quantity}}</p>
My controller: 我的控制器:
$http.get('/api/restros/myorders').success(function(val){
console.log("my orders:");
console.log(val);
var temp=[];
$scope.mydata=val;
$http.get('/api/restros/').success(function(data){
$scope.john=function(parent){
console.log("parent");
console.log(parent);
for(var i=0;i<parent.length;i++){
temp=[];
for(var j=0;j<data.length;j++){
if(data[j]._id==parent[i].id){
temp.push([{name:data[j].name,quantity:parent[i].quantity,rate:data[j].rate}]);
}
}
console.log(typeof (temp[0]));
}
}
});
});
Now I want to show the response in the console like so: 现在,我想在控制台中显示响应,如下所示:
Object: {name: "Beef Burger", quantity: 1, rate: 150}
对象:
{name: "Beef Burger", quantity: 1, rate: 150}
Object: {name: "Maharaja Mac", quantity: 1, rate: 150}
对象:
{name: "Maharaja Mac", quantity: 1, rate: 150}
Z.items是我要解析的项目,它们来自我公司提供给我的API。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.