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
5 years ago
|
import { Component } from '@angular/core';
|
||
5 years ago
|
import { Event, NavigationCancel, NavigationEnd, NavigationError, NavigationStart, Router } from '@angular/router';
|
||
4 years ago
|
import { routeAnimation } from '../shared/animation/route-animation';
|
||
5 years ago
|
|
||
|
@Component({
|
||
2 years ago
|
selector: 'rtl-cln-root',
|
||
2 years ago
|
templateUrl: './cln-root.component.html',
|
||
|
styleUrls: ['./cln-root.component.scss'],
|
||
4 years ago
|
animations: [routeAnimation]
|
||
5 years ago
|
})
|
||
2 years ago
|
export class CLNRootComponent {
|
||
3 years ago
|
|
||
5 years ago
|
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;
|
||
|
}
|
||
|
}
|
||
3 years ago
|
});
|
||
5 years ago
|
}
|
||
3 years ago
|
|
||
5 years ago
|
}
|