mirror of
https://github.com/angular/angular.git
synced 2026-09-14 13:54:52 +08:00
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:
committed by
Jessica Janiuk
parent
78cf51b12a
commit
d69a4e1e15
@@ -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();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user