I have an animation attached to an unnamed ui-view. This works correctly when the router looks like this:
Working example:
$stateProvider .state('home', { url: '/', templateUrl: 'app/main/main.html', controller: 'MainCtrl as main', resolve: { events: function(EventStore) { return EventStore.getAll(); } } }) .state('event', { url: '/event/:id', templateUrl: 'app/event/event.html', controller: 'EventCtrl as eventCtrl', resolve: { event: function(EventStore, $stateParams) { return EventStore.getEvent($stateParams.id); } } })
Working html example:
<div ui-view class="main"></div>
However, when I add different views to the ui-router, for example: Faulty example:
$stateProvider .state('home', { url: '/', views: { 'main': { templateUrl: 'app/main/main.html', controller: 'MainCtrl as main', resolve: { events: function(EventStore) { return EventStore.getAll(); } } }, 'navigation': { templateUrl: 'app/components/navbar/navbar.html', controller: 'NavbarCtrl as navbar', } } }) .state('event', { url: '/event/:id', views: { 'main': { templateUrl: 'app/event/event.html', controller: 'EventCtrl as eventCtrl', resolve: { event: function(EventStore, $stateParams) { return EventStore.getEvent($stateParams.id); } } }, 'aside': { template: '<aside-info ng-if="asideCtrl.displayed"></aside-info>', controller: 'AsideCtrl as asideCtrl' } } })
Broken HTML:
<div ui-view="navigation"></div> <div ui-view="main" class="main"></div> <div ui-view="aside"></div>
Routing and views work correctly, but the animation does not apply. Any ideas why the animations will be ignored in the second example?
Edit 1: Here is the css animation. However, this works correctly if I remove 3 different views.
.transition-background { position: fixed; width: 100%; height: 100vh; } .main { transition: all $totalSpeed $animation .001s; overflow: hidden; &.ng-leave { overflow: hidden; .events { transition: display 0 $animation $speed; } .event-animate { transition: transform $speed2 $animation; position: fixed; overflow: hidden; top: 0; width: 100%; min-height: 100vh; transform: translate(0,0); transform: translate3d(0,0,0); top: 0; z-index: 4; } .transition-background { transition: transform $speed $animation $speed2; background: