(js) Changes for ui-router v1.0

$urlRouterProvider is deprecated.
This commit is contained in:
Francis Lachapelle committed 2018-06-28 15:44:12 -04:00
1 parent a25e0f73be
commit e494dbc57c
5 files changed
+69 -49

No files matched your search

@@ -11,8 +11,8 @@
/**
* @ngInject
*/
configure.$inject = ['$stateProvider', '$urlRouterProvider'];
function configure($stateProvider, $urlRouterProvider) {
configure.$inject = ['$stateProvider', '$urlServiceProvider'];
function configure($stateProvider, $urlServiceProvider) {
$stateProvider
.state('preferences', {
abstract: true,
@@ -58,17 +58,25 @@
});
// if none of the above states are matched, use this as the fallback
$urlRouterProvider.otherwise('/general');
$urlServiceProvider.rules.otherwise('/general');
}
/**
* @ngInject
*/
runBlock.$inject = ['$rootScope'];
function runBlock($rootScope) {
$rootScope.$on('$routeChangeError', function(event, current, previous, rejection) {
console.error(event, current, previous, rejection);
runBlock.$inject = ['$window', '$log', '$transitions', '$state'];
function runBlock($window, $log, $transitions, $state) {
if (!$window.DebugEnabled)
$state.defaultErrorHandler(function() {
// Don't report any state error
});
$transitions.onError({ to: 'preferences.**' }, function(transition) {
if (transition.to().name != 'preferences' &&
!transition.ignored()) {
$log.error('transition error to ' + transition.to().name + ': ' + transition.error().detail);
$state.go({ state: 'preferences' });
}
});
}