RTL/src/app/cln/cln-root.component.ts

37 lines
986 B
TypeScript
Raw Normal View History

import { Component } from '@angular/core';
2023-10-06 14:29:22 -07:00
import { Event, NavigationCancel, NavigationEnd, NavigationError, NavigationStart, Router, RouterEvent } from '@angular/router';
import { routeAnimation } from '../shared/animation/route-animation';
@Component({
standalone: false,
selector: 'rtl-cln-root',
2022-05-04 10:05:06 -04:00
templateUrl: './cln-root.component.html',
styleUrls: ['./cln-root.component.scss'],
animations: [routeAnimation]
})
export class CLNRootComponent {
2021-08-28 17:03:18 -04:00
loading = false;
constructor(private router: Router) {
2023-10-06 14:29:22 -07:00
this.router.events.subscribe((event: Event | RouterEvent) => {
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;
}
}
2021-08-28 17:03:18 -04:00
});
}
2021-08-28 17:03:18 -04:00
}