fix(router): prevent RouterLinkActive
from causing an infinite CD loop
fixes #15825
This commit is contained in:

committed by
Tobias Bosch

parent
5b141fbf27
commit
82417b3ca5
@ -123,10 +123,9 @@ export class RouterLinkActive implements OnChanges,
|
||||
|
||||
// react only when status has changed to prevent unnecessary dom updates
|
||||
if (this.active !== hasActiveLinks) {
|
||||
this.active = hasActiveLinks;
|
||||
this.classes.forEach(
|
||||
c => this.renderer.setElementClass(this.element.nativeElement, c, hasActiveLinks));
|
||||
this.cdr.detectChanges();
|
||||
Promise.resolve(hasActiveLinks).then(active => this.active = active);
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user