我正在尝试使用Restangular来使用Restangular从后端使用休息调用返回一些对象。
它是一个简单的GET调用..不知道为什么我得到一个错误。如果有人可以指出我想要的东西会很棒。
我的restangular电话:
var vm = this;
vm.getEvent = function() {
Restangular.one('/services/v1').one('people').get();
}
对象我应该回来看起来像这样:
[
{
"id": 1,
"name": "string",
"description": "string",
"locations": [
{
"id": 1,
"name": "string",
"description": "string"
}
]
},
{
"id": 2,
"name": "string",
"description": "string",
"locations": [
{
"id": 2,
"name": "string",
"description": "string"
}
]
},
{
"id": 3,
"name": "string",
"description": "string",
"locations": [
{
"id": 2,
"name": "string",
"description": "string"
}
]
}
]
在html中调用它时出现此错误:
错误:[$ rootScope:infdig] 10 $ digest()迭代达成。中止! 观察者在最近5次迭代中被解雇:[]
编辑:
端点
答案 0 :(得分:0)
您的代码应如下所示
var vm = this;
vm.getEvent = function() {
Restangular.one('/services/v1').get('people').then(function(data){console.log("data",data)});
}