I have a few simple states set up as well as a default state for invalid URLs.
$stateProvider
.state('visitor', {
url: '/visitor',
templateUrl: '/visitor/register.html',
controller: 'RegisterController'
})
.state('member', {
url: '/member',
templateUrl: '/member/login.html',
controller: 'AuthController'
});
$urlRouterProvider.otherwise('/visitor');
In the case of an invalid URL, I'd like to be able to capture it and then pass it along to the default state's controller so that I can log it somewhere, display it to the user once they've been redirected to the default view, whatever....
Aside from the URL matching, is there any object through which that invalid URL would be exposed?
There is the $stateNotFound event that would be perfect if it fired in the case of invalid URLs being requested as well as states. Alas, this does not seem to be the case.