query string in $resource url

You can use resource parameters. If you haven’t specified placeholders in the path, they would automatically be converted into query string params. Like that:

angular
    .module('myServices', ['ng', 'ngResource'])
    .factory('Item', [
         '$resource',
         function ($resource) {
             return $resource('/api');
     }]);

Item.query({p: 'item/1'});

This would result in a request to /api?p=item/1.

P.S.

I suppose you already know that, but you don’t like it. But I still think this is the correct way in your case. Considering the bad API design you are dealing with that back-end you could wrap the AngularJS resources with another service which does this for you.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)