gpt4 book ai didi

angularjs - 将响应数据插入表中

转载 作者:行者123 更新时间:2023-12-02 22:44:50 29 4
gpt4 key购买 nike

回应:

    {
"json": {
"response": {
"servicetype": "1",
"functiontype": "1000",
"statuscode": "0",
"statusmessage": "Success",
"data": [{
"groupzname": "NARAYANA E-SCHOOL1",
"groupzcode": "CHATCH",
"area": "JAYANAGARA 9TH BLOCK",
"city": "BENGALURU",
"state": "Karnataka",
"country": "INDIA"
},

{
"shortname": "School",
"groupzname": "Smitha School",
"groupzcode": "4353",
"area": "fsdfsdf",
"city": "sdfsf",
"state": "vxcvxv",
"country": "vxcvxv"
}, {
"shortname": "SerReq",
"groupzname": "Service R",
"groupzcode": "SerReq",
"area": "SerReq",
"city": "SerReq",
"state": "SerReq",
"country": "SerReq"
}, {
"shortname": "service",
"groupzname": "Service Gropz",
"groupzcode": "1111",
"area": "jayanagar",
"city": "bangalore",
"state": "Karnataka",
"country": "India"
}, {
"shortname": "Testing",
"groupzname": "Smitha Groupz",
"groupzcode": "5555",
"area": "jayanagar 9th block",
"city": "Bangalore",
"state": "Karnataka",
"country": "India"
},

{
"shortname": "May12R2",
"groupzname": "May12Release2",
"groupzcode": "May12R2",
"area": "May12R2Area: ",
"city": "May12City",
"state": "May12State",
"country": "May12Country"
}, {
"shortname": "May12",
"groupzname": "May12Release",
"groupzcode": "May12",
"area": "May12 Area",
"city": "May12 city",
"state": "May12 State",
"country": "May12 Country"
}, {
"shortname": "Kank",
"groupzname": "Kankar",
"groupzcode": "knakr12",
"area": "Kankar Area",
"city": "Kankar city",
"state": "Kankar state",
"country": "Kankarcountry"
}, {
"shortname": "Hir",
"groupzname": "Heera",
"groupzcode": "Hir001",
"area": "Hir are",
"city": "Hir cit",
"state": "Hir State",
"country": "Hir India"
},

{
"shortname": "Apr",
"groupzname": "Aparajitha",
"groupzcode": "Apraj20",
"area": "apar area",
"city": "apar city",
"state": "apar state",
"country": "apar indi"
}
]
}
}
}

我必须将此响应中的上述短名称、groupzname、groupzcode、区域、城市、国家等动态插入表中。

JS:

     $scope.viewAccount = function(){
$scope.showListAccount = true;

var json = {

"json": {
"request": {
"servicetype": "6",
"functiontype": "6014",
"session_id": $rootScope.currentSession,
"data": {
"sortbasedon": $scope.groupzname,
"orderby": "desc",
"limit":10,
"offset":10
}

}
}
};

UserService.viewListAccount(json).then(function(response) {



if (response.json.response.statuscode == 0 && response.json.response.statusmessage == 'Success')

$scope.dataArray = response.json.response.data;



$scope.myname = $scope.dataArray.shortname;
console.log($scope.myname);


});
};

如果我通过上述请求并控制台数据,则会面临不断增加的错误。 angular.js:68 未捕获错误:[$rootScope:infdig] 已达到 10 $digest() 迭代。流产!最近 5 次迭代中触发的观察者:[]

最佳答案

使用以下代码显示到表格中。

<table>                
<tr>
<th>groupzcode</th>
<th>area</th>
<th>city</th>
<th>state</th>
<th>country</th>
</tr>
<tbody>
<tr data-ng-repeat="data in output.json.response.data">
<td>{{ data.shortname}}</td>
<td>{{data.groupzname}}</td>
<td>{{data.groupzcode}}</td>
<td>{{data.area}}</td>
<td>{{data.city}}</td>
<td>{{data.state}}</td>
<td>{{data.country}}</td>
</tr>
</tbody>
</table>

输出是json输出。

关于angularjs - 将响应数据插入表中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39329213/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com