0

I've got a factory like that :

app.factory('AccordDepartement', function($resource, HttpCache) {    
            return  $resource('mocks/departements.json', {}, {
                query: {
                    isArray: true,
                    method:'GET',
                    cache: HttpCache
                },
                metropole: {
                    isArray: true,
                    method:'GET',
                    params: {metropole:true},
                    cache: HttpCache
                }
            });
        });

And i use it in a service like that :

 AccordDepartement.metropole(function (data) {
     console.log(data);
 });

But the matter is that it seems parameters are ignored.

Is it because my url is a json file ? Or i miss something important here ?

Thomas Pons
  • 7,709
  • 3
  • 37
  • 55

1 Answers1

1

The $resource will return the response for the server. In this case, using a static json file, will be the same json for every request that you made because there is no server logic to create the json data dinamically.

Consider to use a different json file for your second request, to mock an specific json what you want.

Deividi Cavarzan
  • 10,034
  • 13
  • 66
  • 80