Inside my NG2 application, I use resolver , which makes a connection to signalr.
I set up a resolver inside my route configuration , so when I navigate the landing page, the permission function is called.
I managed to show the animation when the landing page is initialized.
However, I would like to show the " is-busy " animation DURING the resolution of my resolver, but I do not know how to do it. Any suggestions?
This is my current setup:
@Injectable()
export class ConnectionResolver implements Resolve<SignalRConnectionMock> {
constructor(private _signalR: SignalR) {}
resolve() {
console.log('HomeRouteResolver. Resolving...');
return new SignalRConnectionMock();
}
}
{ path: 'docs',
component: DocumentationComponent,
resolve: { connection: ConnectionResolver }
}
import { trigger, state, animate, style, transition } from '@angular/core';
export function routerTransition() {
return slideToLeft();
}
function slideToLeft() {
return trigger('routerTransition', [
state('void', style({position: 'fixed', width: '100%'}) ),
state('*', style({position: 'fixed', width: '100%'}) ),
transition(':enter', [
style({transform: 'translateX(100%)'}),
animate('0.5s ease-in-out', style({transform: 'translateX(0%)'}))
]),
transition(':leave', [
style({transform: 'translateX(0%)'}),
animate('0.5s ease-in-out', style({transform: 'translateX(-100%)'}))
])
]);
}
import { routerTransition } from './route.transition';
@Component({
selector: 'home',
animations: [routerTransition()],
host: {'[@routerTransition]': ''}
})
export class HomeComponent {}
source
share