I've got a bit of a pickle that I hope you can help out with. I'm, working on making an Ionic version of an Angular web application that I have recently build. Since it is essentially the same angular between the two, you would think they would react the same, but here's where to goes wrong...
This is my Angular resource factory...
.factory('applicationFactory', ['$resource', 'AuthFactory', '$rootScope', function ($resource, AuthFactory, $rootScope) {
return $resource($rootScope.serverURL + "applications", {},
{
'query': {
method: 'get',
isArray: true,
headers: {'auth-token': AuthFactory.authToken}
}
});
}])
And this is my controller that calls it...
.controller('ApplicationController', ['$scope', '$rootScope', '$state', 'applicationFactory', 'AuthFactory', function ($scope, $rootScope, $state, applicationFactory, AuthFactory) {
$scope.applications = applicationFactory.query();
This combination ends up yielding this error:
ionic.bundle.js:25642 Error: [$resource:badcfg] Error in resource configuration for action `get`. Expected response to contain an object but got an array (Request: GET https://communityservermanager.herokuapp.com/applications)
As you can see I have clearly marked the isArray configuration option as true. Also as I said before this is directly copied and pasted from an existing angular application, where it works just fine. What the heck am I doing wrong!?!?
Thanks in advance for the help :)