build: update dependency ngx-progressbar to v13 (#58822)

See associated pull request for more information.

Closes #58696 as a pr takeover

PR Close #58822
This commit is contained in:
Angular Robot
2024-11-16 02:35:43 +00:00
committed by Jessica Janiuk
parent 78cf51b12a
commit d69a4e1e15
4 changed files with 13 additions and 11 deletions
@@ -26,7 +26,8 @@ describe('ProgressBarComponent', () => {
});
it('should call progressBar.complete() on route change', async () => {
const progressBarCompleteSpy = spyOn(component.progressBar, 'complete');
const progressBar = component.progressBar();
const progressBarCompleteSpy = spyOn(progressBar, 'complete');
const harness = await RouterTestingHarness.create();
await harness.navigateByUrl('/');
@@ -12,10 +12,11 @@ import {
inject,
OnInit,
PLATFORM_ID,
ViewChild,
Signal,
viewChild,
} from '@angular/core';
import {isPlatformBrowser} from '@angular/common';
import {NgProgressbar} from 'ngx-progressbar';
import {NgProgressbar, NgProgressRef} from 'ngx-progressbar';
import {
NavigationCancel,
NavigationEnd,
@@ -41,7 +42,7 @@ export const PROGRESS_BAR_DELAY = 30;
export class ProgressBarComponent implements OnInit {
private readonly router = inject(Router);
@ViewChild(NgProgressbar, {static: true}) progressBar!: NgProgressbar;
progressBar = viewChild.required(NgProgressRef);
isBrowser = isPlatformBrowser(inject(PLATFORM_ID));
@@ -62,7 +63,7 @@ export class ProgressBarComponent implements OnInit {
map(() => {
// Only apply set the property if the navigation is not "immediate"
return setTimeout(() => {
this.progressBar.start();
this.progressBar().start();
}, PROGRESS_BAR_DELAY);
}),
switchMap((timeoutId) => {
@@ -83,7 +84,7 @@ export class ProgressBarComponent implements OnInit {
.subscribe((timeoutId) => {
// When the navigation finishes, prevent the navigating class from being applied in the timeout.
clearTimeout(timeoutId);
this.progressBar.complete();
this.progressBar().complete();
});
}
}