mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-07 18:14:17 +00:00
67611: ExpressionChangedAfterItHasBeenCheckedError fix
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
import { filter, map, take } from 'rxjs/operators';
|
import { delay, filter, map, take } from 'rxjs/operators';
|
||||||
import { AfterViewInit, ChangeDetectionStrategy, Component, HostListener, Inject, OnInit, ViewEncapsulation } from '@angular/core';
|
import { AfterViewInit, ChangeDetectionStrategy, Component, HostListener, Inject, OnInit, ViewEncapsulation } from '@angular/core';
|
||||||
import { NavigationCancel, NavigationEnd, NavigationStart, Router } from '@angular/router';
|
import { NavigationCancel, NavigationEnd, NavigationStart, Router } from '@angular/router';
|
||||||
|
|
||||||
@@ -125,8 +125,11 @@ export class AppComponent implements OnInit, AfterViewInit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ngAfterViewInit() {
|
ngAfterViewInit() {
|
||||||
this.router.events
|
this.router.events.pipe(
|
||||||
.subscribe((event) => {
|
// This fixes an ExpressionChangedAfterItHasBeenCheckedError from being thrown while loading the component
|
||||||
|
// More information on this bug-fix: https://blog.angular-university.io/angular-debugging/
|
||||||
|
delay(0)
|
||||||
|
).subscribe((event) => {
|
||||||
if (event instanceof NavigationStart) {
|
if (event instanceof NavigationStart) {
|
||||||
this.isLoading = true;
|
this.isLoading = true;
|
||||||
} else if (
|
} else if (
|
||||||
|
Reference in New Issue
Block a user