I want bad routes to navigate to the root route. I've added a mapUnknownRoutes
configuration on my router.
config.mapUnknownRoutes((inst) => inst.config.moduleId = 'home');
But this leaves the route untouched. For example, #/fakeRoute
routes to home. Ideally, I would like a behavior similar to returning { redirect: '#/' }
, which cancels navigation and creates a new navigation to the route '#/'
. Is this a feature?
The
mapUnknownRoutes
method also accepts aRouteConfig
object so you can just directly specify your redirect there:See the complete signature of the method on github