You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
36 lines
938 B
TypeScript
36 lines
938 B
TypeScript
import { Component } from '@angular/core';
|
|
import { Event, NavigationCancel, NavigationEnd, NavigationError, NavigationStart, Router } from '@angular/router';
|
|
import { routeAnimation } from '../shared/animation/route-animation';
|
|
|
|
@Component({
|
|
selector: 'rtl-lnd-root',
|
|
templateUrl: './lnd-root.component.html',
|
|
styleUrls: ['./lnd-root.component.scss'],
|
|
animations: [routeAnimation]
|
|
})
|
|
export class LNDRootComponent {
|
|
|
|
loading = false;
|
|
|
|
constructor(private router: Router) {
|
|
this.router.events.subscribe((event: Event) => {
|
|
switch (true) {
|
|
case event instanceof NavigationStart: {
|
|
this.loading = true;
|
|
break;
|
|
}
|
|
case event instanceof NavigationEnd:
|
|
case event instanceof NavigationCancel:
|
|
case event instanceof NavigationError: {
|
|
this.loading = false;
|
|
break;
|
|
}
|
|
default: {
|
|
break;
|
|
}
|
|
}
|
|
});
|
|
}
|
|
|
|
}
|