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