query string in $resource url

后端 未结 2 2046
隐瞒了意图╮
隐瞒了意图╮ 2020-12-25 11:09

my service has to use a query string due to limitations on the server that runs classic ASP:

angular
  .module(\'myServices\', [\'ng\', \'ngResource\'])
  .f         


        
2条回答
  •  爱一瞬间的悲伤
    2020-12-25 11:44

    var deferred = $q.defer();
    api.api_name.query({
        'param':param_value
    },
        function(response) {
            deferred.resolve(response);
        },
        function(response) {
            deferred.reject(response);
        }
    );
    //
    angular
        .module('module_name')
        .factory('api',function($resource){
            var api_var={};
            api_var.api_name = $resource('url?param_key=:param', {
                param: '@param'
            }, {
                'query': {
                    method: 'get'
                }
            });
            return api_var;
        });
    

提交回复
热议问题