Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

AngularJS: Restangular - How to remove query param from URL

I setup API base url in Main.js with query param "advertiserId". I would like to remove the query param advertiserId in Demo.js. Note I don't want to use $location search params (since these are search params from current window URL not the URL I constructed).

Main.js:

  Restangular.setBaseUrl("localhost:9000/advertisers");
  Restangular.setDefaultRequestParams({
    "advertiserId": advertiserID
  });

Demo.js

 Restangular.RemoveRequestParams({
    "advertiserId": advertiserID
 });
like image 305
Inaccessible Avatar asked Nov 09 '22 11:11

Inaccessible


1 Answers

Couldn't you also just reset the defaults to an empty object in Demo.js?

Restangular.SetDefaultRequestParams({});

I'm guessing that the Restangular you're using in Demo.js is a newly created instance from the Restangular Service?

like image 84
Brendon Colburn Avatar answered Nov 14 '22 22:11

Brendon Colburn