0
m
符合下列要求工厂获取生成:角度解析获取返回
var m = $http({method: 'GET', url: JSONurl});
GET请求后
m
控制台日志:
我需要抓住m
的“data:”其中有我需要的Array[2]
。我将如何创建一个只有数据数组的新变量?
m
符合下列要求工厂获取生成:角度解析获取返回
var m = $http({method: 'GET', url: JSONurl});
GET请求后
m
控制台日志:
我需要抓住m
的“data:”其中有我需要的Array[2]
。我将如何创建一个只有数据数组的新变量?
如果你看一下angularJS docs for $http,你会发现你需要使用诺言来获取数据。所以你想要的东西沿线:
$http({
method: 'GET',
url: JSONurl
}).then(function successCallback(response) {
//response has the data on a successful call
}, function errorCallback(response) {
//this response will have the error data on a failed call
});
'm.then(res => res.data)'' – Phil