Reputation: 8047
I use angularjs 1.6 on my routes I have the following
when('/myview', {
templateUrl: 'mc/templates/myview.html',
controller: 'myviewController'
}).
otherwise({
redirectTo: '/defaultView'
});
When I access myview with search parameters it loads the myview view
/myview?foo=bar
When I try to redirect to this view though
$location.path(' /myview?foo=bar');
Does not work and loads the defaultView
How can I redirect on a view with search parameters ?
Upvotes: 0
Views: 35
Reputation: 222522
You should use
$state.go("myview", { foo: 'bar' });
or with location use .search
$location.path('/myview').search('foo', 'bar')
Upvotes: 1