cucuru
cucuru

Reputation: 3698

location.search not redirect

I have this in my js:

var data = "newValue";
$('#myButton').on('click', function() {
      var params = location.href.split('?')[1].replace(/#.*/g,'');
      location.hash = 'myhash';
      location.search = params + '&newData='+ data;

    });

it always change the url I can see in the browser, but it's not always launched.

what is my problem?

Upvotes: 0

Views: 248

Answers (1)

Yrysbek Tilekbekov
Yrysbek Tilekbekov

Reputation: 2775

To change the value of search parameter in angular, you just need to do:

$location.search('someVar','newValue');

Upvotes: 2

Related Questions