einav
einav

Reputation: 609

UI-Router - use $state.go or $location.path?

What do you think is better using : $state.go or $location.path?

My animation doesn't work with state.go but do with $location.path.

Does any one know why?

Thanks!

Upvotes: 10

Views: 13377

Answers (1)

Sven Schürmann
Sven Schürmann

Reputation: 612

You can use the module ngAnimate instead of ngClass directive to animate view/state changes. The module adds specific css classes on elements which changes. To see animations in action, you must only define the appropriate CSS classes

Here you can find an small introduction how this with the ui-router module works.

UPDATE

Sorry for the delay... There is no reason why this shouldn't work. The UI-router plugin internally call $state.go() when $location.path changed.

See the forked plunker how $state.go() works in combination with ngAnimate module.

Upvotes: 4

Related Questions