I'm trying to make a list of persons. My HTTP server is able to give a JSON representation of a person on URLs like /person/[id].json
, and a list of all persons at /person.infinity.json
.
So I have the controller, where I have defined the Person
resource:
var app = angular.module('myApp', ["ngResource"])
.controller('PersonController', function PersonController($scope, $http, $resource) {
var Person = $resource("/person/:personId.json",
{ personId: '@id' },
{ list: {method: "GET", url: "/person.infinity.json", isArray: true}}
);
$scope.persons = Person.list();
});
However, when Person.list()
is called, my custom URL for the list
method (/person.infinity.json
) is not used. Chrome´s network inspector reveals that a request is fired to /person/.json
, that is, the default resource URL with no parameter set.
Obviously, I would like Person.list()
to result in a request to /person.infinity.json
.
What am I doing wrong?