【发布时间】:2015-08-20 20:39:22
【问题描述】:
我是 angular 新手,我正在尝试加载 json 文件并在索引文件上重复它,但可以通过该 json 来获取重复的数组
app.js
chatApp.controller('userCtrl', function ($scope, $filter, $http) {
var obj = {content:null};
$http.get('test.json').success(function(data) {
obj.content = data;
});
console.log(obj);});
json 文件
{"data":
{"result":"success","customers_list":[
{"Chat":
{
"name": "John",
"town":"LA"
}},
{"Chat":
{
"name": "Peter",
"town":"NY"
}}],"message":"The function is correctly"}}
我想得到名称和城镇,任何想法如何通过 data-> customer_list 直到我得到类似的东西:
$scope.loadChat =[
{
"name": "John",
"town":"LA"
},
{
"name": "Peter",
"town":"NY"
}
];
【问题讨论】: