Skip to content

Instantly share code, notes, and snippets.

@tadas-s
Created November 19, 2014 16:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tadas-s/c247ac75e6418871455c to your computer and use it in GitHub Desktop.
Save tadas-s/c247ac75e6418871455c to your computer and use it in GitHub Desktop.
AngularJS + ui-router debug snippet
app.run(function($rootScope) {
$rootScope.$on('$stateChangeStart', function(event, toState, toParams, fromState, fromParams) {
console.group('$stateChangeStart ' + fromState.name + ' => ' + toState.name);
console.group('from:');
console.log(fromState);
console.log(fromParams);
console.groupEnd();
console.group('to:');
console.log(toState);
console.log(toParams);
console.groupEnd();
console.groupEnd();
});
$rootScope.$on('$stateChangeError', function(event, toState, toParams, fromState, fromParams) {
console.group('$stateChangeError ' + fromState.name + ' => ' + toState.name);
console.group('from:');
console.log(fromState);
console.log(fromParams);
console.groupEnd();
console.group('to:');
console.log(toState);
console.log(toParams);
console.groupEnd();
console.groupEnd();
});
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment