I'm working in Cloud9, following a tutorial. I've to the point where I'm trying load the data within mongo to the view. The table structure seems to get generated but no data is populated.
From Chrome I see the following:
Error: Response for getList SHOULD be an array and not an object or something else
And the response from the page load within Chrome is:
0: {undefined: {}}
1: {undefined: {}}
2: {undefined: {}}
3: {undefined: {}}
4: {undefined: {}}
My View
<table class="table table-striped">
<thead>
<th>Title</th>
<th>Reason</th>
<th>Actions</th>
<th>Requester</th>
<th>Verified</th>
</thead>
<tbody>
<tr ng-repeat="change in changes">
<td>{{ change.title }}</td>
<td>{{ change.reason }}</td>
<td>{{ change.actions }}</td>
<td>{{ change.requester }}</td>
<td>{{ change.verified }}</td>
</tr>
</tbody>
</table>
My Controller
'use strict';
/**
* @ngdoc function
* @name clientApp.controller:ChangeCtrl
* @description
* # ChangeCtrl
* Controller of the clientApp
*/
angular.module('clientApp')
.controller('ChangeCtrl', function ($scope, Change) {
$scope.changes = Change.getList().$oject;
});
My APP.JS
'use strict';
/**
* @ngdoc overview
* @name clientApp
* @description
* # clientApp
*
* Main module of the application.
*/
angular
.module('clientApp', [
'ngRoute',
'restangular'
])
.config(function ($routeProvider, RestangularProvider) {
RestangularProvider.setBaseUrl('http://ift.tt/1BWniuU');
$routeProvider
.when('/', {
templateUrl: 'views/main.html',
controller: 'MainCtrl'
})
.when('/about', {
templateUrl: 'views/about.html',
controller: 'AboutCtrl'
})
.when('/change', {
templateUrl: 'views/change.html',
controller: 'ChangeCtrl'
})
.otherwise({
redirectTo: '/'
});
})
.factory('ChangeRestangular', function(Restangular) {
return Restangular.withConfig(function(RestangularConfigurer) {
RestangularConfigurer.setRestangularFields({
id: '_id'
});
});
})
.factory('Change', function(ChangeRestangular) {
return ChangeRestangular.service('change');
});
I'm sure this is something simple but I just can't see it!
Thanks
Aucun commentaire:
Enregistrer un commentaire