Skip to content

Instantly share code, notes, and snippets.

@vucalur
Created June 28, 2014 08:02
Show Gist options
  • Save vucalur/639e6f50309da390ff51 to your computer and use it in GitHub Desktop.
Save vucalur/639e6f50309da390ff51 to your computer and use it in GitHub Desktop.
UI-Router debugging snippet for CoffeeScript
$rootScope = @$scope.$root
$rootScope.$on('$stateChangeStart', (event, toState, toParams, fromState, fromParams) ->
console.log('$stateChangeStart to ' + toState.to + '- fired when the transition begins. toState,toParams : \n', toState, toParams);
console.log(arguments)
)
$rootScope.$on('$stateChangeError', (event, toState, toParams, fromState, fromParams) ->
console.log('$stateChangeError - fired when an error occurs during transition')
console.log(arguments)
)
$rootScope.$on('$stateChangeSuccess', (event, toState, toParams, fromState, fromParams) ->
console.log('$stateChangeSuccess to ' + toState.name + '- fired once the state transition is complete.')
console.log(arguments)
)
$rootScope.$on('$viewContentLoading', (event, viewConfig) ->
console.log('$viewContentLoading - fired before dom rendered', event, viewConfig)
)
$rootScope.$on('$viewContentLoaded', (event) ->
console.log('$viewContentLoaded - fired after dom rendered', event)
)
$rootScope.$on('$stateNotFound', (event, unfoundState, fromState, fromParams) ->
console.log('$stateNotFound ' + unfoundState.to + ' - fired when a state cannot be found by its name.')
console.log(unfoundState, fromState, fromParams)
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment