Мне нужен совет, как перезагрузить компонент, когда URL изменился. Теперь он загружается один раз, поэтому изменение отображения одной плитки (элемента этого компонента) зависит от того, URL не работает. Я пытался с ActivatedRoute, но безуспешно.
Мой код:
import { Component, ElementRef, Input, OnDestroy, OnInit, ViewChild } from '@angular/core';
import { WindowRef } from '../../../shared/services/window-ref.service';
import { TranslateService } from '@ngx-translate/core';
import { Location } from '@angular/common';
import { ActivatedRoute } from '@angular/router';
import { find } from 'lodash';
@Component({
selector: 'lex-user-zone',
templateUrl: './user-zone.component.html',
styleUrls: ['./user-zone.component.scss']
})
export class UserZoneComponent implements OnDestroy, OnInit {
@Input() preferencesMenu: any;
@Input() borgSessionId: string;
@Input() showIntro: () => void;
@ViewChild('wkLimboPlaceholder') wkLimboPlaceholder: ElementRef;
wkLibmoCustomLabels: any;
constructor(
private windowRef: WindowRef,
private translateService: TranslateService,
private location: Location,
private activatedRoute: ActivatedRoute,
) {}
ngOnInit(): void {
const wkLimbo = (<any>this.windowRef.nativeWindow).WkLimbo;
this.getWkLibmoCustomLabels().then((translations: any) => {
this.wkLibmoCustomLabels = translations;
if (wkLimbo && wkLimbo.Menu) {
this.wkLimboReadyEventHandler();
} else {
this.windowRef.nativeWindow.addEventListener('wk-limbo-ready', () => {
this.wkLimboReadyEventHandler();
});
}
});
}