> For the complete documentation index, see [llms.txt](https://hemantajax-2.gitbook.io/angular-ui-router/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://hemantajax-2.gitbook.io/angular-ui-router/state-events.md).

# State Events

```javascript
angular.module("myApp")
    .run(function($rootScope){
        $rootScope.$on('$stateChangeStart', function(event, toState, toParams, fromState, fromParams){

        });
        $rootScope.$on('$stateChangeSuccess', function(event, toState, toParams, fromState, fromParams){

        });
        $rootScope.$on('$stateChangeError', function(event, toState, toParams, fromState, fromParams, error){

        });
        $rootScope.$on('$stateNotFound', function(event, unfoundState, fromState, fromParams){

        });
    });
```
