How to redirect $ routeProvider.otherwise () saving specified request parameters

Let's say I go to /unknown-route?a=hello&b=world and $routeProvider does not recognize it and does not redirect to another route:

 otherwise({ redirectTo: '/default-route' }); 

Is it possible to pass the specified parameters to the redirected route.

Here it will be /default-route?a=hello&b=world

+7
angularjs angularjs-routing
source share
1 answer

I found a working solution:

 otherwise({ redirectTo: function() { return '/default-route' + location.search; } }) 
+10
source share

All Articles