In my main routes, I have a profile module that lazy has loaded on /profile
as follows:
{ path: '', component: HomeComponent }, { path: 'profile', loadChildren: './profile/profile.module#ProfileModule' }, { path: '**', redirectTo: '', pathMatch: 'full' }
However, my profile module takes ~ 1.5 - 2 seconds to load, which is rather slow. I would like to show some kind of boot animation while my module is loading, anyway? I tried to do this:
app.component.html
<router-outlet></router-outlet> <div class="loading"> <div class="spinner"> <div class="rect1"></div> <div class="rect2"></div> <div class="rect3"></div> <div class="rect4"></div> <div class="rect5"></div> </div> </div>
and inside my css, I had:
.loading { opacity: 0; transition: opacity .8s ease-in-out; position: fixed; height: 100%; width: 100%; top: 0; left: 0; background: #1B1B1B; color: white; z-index: -1; } router-outlet:empty + .loading, router-outlet:empty + .spinner { opacity: 1; z-index: 100; }
But this does not seem to work. Is there any bootloader at all while angular2 modules are loading?
source share