mirror of
https://dev.azure.com/hugendubel/ISA/_git/ISA-Frontend
synced 2025-12-31 09:37:15 +01:00
Fix für Anzeigefehler im SectionToggle
This commit is contained in:
@@ -9,6 +9,7 @@ import {
|
||||
AfterViewInit,
|
||||
OnChanges,
|
||||
SimpleChanges,
|
||||
OnDestroy,
|
||||
} from '@angular/core';
|
||||
|
||||
@Component({
|
||||
@@ -17,7 +18,9 @@ import {
|
||||
styleUrls: ['section-toggle.component.scss'],
|
||||
changeDetection: ChangeDetectionStrategy.OnPush,
|
||||
})
|
||||
export class ShellSectionToggleComponent implements AfterViewInit, OnChanges {
|
||||
export class ShellSectionToggleComponent implements AfterViewInit, OnChanges, OnDestroy {
|
||||
private _interval: any;
|
||||
|
||||
@Input()
|
||||
section: string = 'customer';
|
||||
|
||||
@@ -32,6 +35,10 @@ export class ShellSectionToggleComponent implements AfterViewInit, OnChanges {
|
||||
|
||||
constructor(private readonly _elementRef: ElementRef, private readonly _renderer: Renderer2) {}
|
||||
|
||||
ngOnDestroy(): void {
|
||||
clearInterval(this._interval);
|
||||
}
|
||||
|
||||
ngOnChanges(changes: SimpleChanges): void {
|
||||
if (changes.section) {
|
||||
this.updateSwitchPositionAndSize();
|
||||
@@ -39,6 +46,7 @@ export class ShellSectionToggleComponent implements AfterViewInit, OnChanges {
|
||||
}
|
||||
|
||||
ngAfterViewInit(): void {
|
||||
this._interval = setInterval(() => this.updateSwitchPositionAndSize(), 1000);
|
||||
this.updateSwitchPositionAndSize();
|
||||
}
|
||||
|
||||
@@ -47,6 +55,7 @@ export class ShellSectionToggleComponent implements AfterViewInit, OnChanges {
|
||||
this.section = section;
|
||||
this.sectionChange.emit(section);
|
||||
}
|
||||
|
||||
this.updateSwitchPositionAndSize();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user