我的服务中有两个错误。它们都是相同的错误。我将发布我的服务和控制器。
这是我的服务:
getData: function (dataRecievedCallback, schemeid, userid) {
//Average JSON api
averageData = function () {
return $http.get(first.json)
}
//User JSON api
userData = function () {
return $http.get(second.json)
}这是我的控制器:
serviceName.averageData().then(function (response) {
$scope.firstData = response.data;
});
serviceName.userData().then(function (response) {
$scope.secondData = response.data;
});我不想详细说明我的数据,我想按原样显示它。在我的html中我有一个ng-repeat,我怎么才能在我的表达式中同时添加这两个呢?
发布于 2016-04-05 17:25:21
下面是一个示例,说明应该如何设置此设置:
服务:
methodName: function() {
return $http.get(first.json);
}控制器:
ServiceName.methodName().then(function(response) {
$scope.firstData = response.data;
}).catch(function(error) {
console.log(error); // See the error in console if any
});https://stackoverflow.com/questions/36421990
复制相似问题