I use https://github.com/angular-ui/ui-router library. When I try to access index route (\'/\') I\'m redirected to 404. The code:
angular.module(\'cr\').config(f
You've declared how to behave when any unknown/other route is provided - go to /404
.
But we also have to define how to behave, when some expected, but not "exact" / "not known" route is accessed, ie. create alias
That's where the .when()
could/should be used:
...
// the known route, with missing '/' - let's create alias
$urlRouterProvider.when('', '/');
// the unknown
$urlRouterProvider.otherwise('/404');