I am trying to redirect invalid urls with the following
angular.module('myApp').config(function($stateProvider, $urlRouterProvider) {
$urlRouterProvider.otherwise('/login');
$stateProvider
.state('test',{
url:'/test',
templateUrl: 'views/test.html'
})
.state('login',{
url:'/login',
templateUrl: 'views/login.html'
});
}).
This url gets redirected http://localhost/#/random but this doesn't http://localhost/random and I get
Cannot GET /random
I think it is because it is outside of angular (no hash #).
How do I catch people typing in random urls and redirect them appropriately?
I don't want to use $locationProvider.html5Mode(true);
for browser support issues.
I am using grunt serve for local front-end development and packaging and running with spring boot in production.