In my app.js
, I am utilizing AngularJS along with ui-router. The code snippet below sets the default route:
$urlRouterProvider.otherwise('/');
However, rather than redirecting to a URL, I need it to direct to a specific state:
.state('404',
{
views: {
'body': {
templateUrl: 'partials/404.html',
}
}
});
Typically, I would achieve this using:
$state.go('404');
Is there any way to apply this approach to the otherwise method?
Note that in my 404 state, there is no associated URL. Essentially, it retains the user's entered or visited URL while changing the template.