How do you define transition between two states in angular?



How do you define transition between two states in angular?..

Answer / Rajeev Sharma

In AngularJS, transitions are defined using a combination of state, stateTransition and animation rules within the $stateProvider. Here's an example of defining a transition from 'home' to 'about':n```javascriptn$stateProvidern .state('about', { /* ... */ })n .state('home', {n views: {n 'main': {n templateUrl: 'home.html',n controller: 'HomeCtrl'n }n },n transition: {n to: 'about',n notify: true,n onEnter: function($rootScope) {n $rootScope.$broadcast('transitionStart');n },n onExit: function() {n // Perform any cleanup or save state heren }n }n })n```

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More AngularJS Interview Questions

How to bind selection box with options in the angular js?

1 Answers  


How is AngularJS Compilation Different From Other JavaScript Frameworks?

1 Answers  


How to enable and disable buttons with using condition?

1 Answers  


What is activatedroutesnapshot in angular 2?

1 Answers  


What is json web token in angularjs?

1 Answers  


What is export array in angular 2?

1 Answers  


What are the key components of angular 2?

1 Answers  


Is angular 4 services which traverse the dom looking for attributes?

1 Answers  


What is event binding in angular?

1 Answers  


What is auto bootstrap process in AngularJS?

1 Answers  


How to validate data in angular js?

1 Answers  


What do you understand by rest in angular?

1 Answers  


Categories