因此,它看起來像例子,你可以這樣做:
App.controller('ProjectListCtrl', ['$scope', 'Restangular', function($scope, Restangular) {
$scope.projects = Restangular.all('project/').getList();
}]);
但是,這並不爲我工作。當我NG-重複的項目的項目,並期待在範圍內,我看到:
{
projects: {
then: null
catch: null
finally: null
call: null
get: null
restangularCollection: true
push: null
}
}
它看起來像一個未解決的承諾對象吧?
這工作得很好,但更詳細:
lgtApp.controller('ProjectListCtrl', ['$scope', 'Restangular', function($scope, Restangular) {
Restangular.all('project/').getList().then(function(projects){
$scope.projects = projects;
});
}]);
我錯過了什麼?這是在文檔:
$scope.owners = house.getList('owners')
要不要緊,但這個時候,我在紋波鉻插件測試PhoneGap的應用情況。
這應該是公認的答案 – yar1
好像不是具有與此多少運氣。它返回一個空數組 - http://stackoverflow.com/questions/27844177/restangular-data-getting-into-scope-for-a-list – Horse