Default $resource POST data

前端 未结 7 1346
天命终不由人
天命终不由人 2021-02-07 11:51

That might be strange but I need to specify some default POST data for my $resource using the factory method of the module.

Does anyone have an idea of how to do that in

7条回答
  •  面向向阳花
    2021-02-07 12:33

    Wrapper function will work.

    function myPost(data) {
      return $http.post('http://google.com', angular.extend({default: 'value'}, data))
    }
    
    myPost().success(function(response) { ... });
    

提交回复
热议问题