See this error documentation: https://docs.angularjs.org/error/$resource/badcfg
This occurs when angular is expecting an array or an object, and receiving the opposite. query()
expects an array to be returned from your endpoint, while get()
expects an object.
Also, you should change your query()
syntax above to:
Users.query().then(function(result){
$scope.users = result;
});
This is because angular is phasing out the automatic handling of promises returned via $http
.