import { Injectable, OnDestroy } from '@angular/core'; import { NaI18NService } from '../i18n/na-i18n.service'; import { BehaviorSubject, Subscription, Observable } from 'rxjs'; import { NaMenu } from './na-menu'; import { share } from 'rxjs/operators'; @Injectable({ providedIn: 'root' }) export class NaMenuService implements OnDestroy { private _change$: BehaviorSubject = new BehaviorSubject([]); private i18n$: Subscription; private data: NaMenu[] = []; constructor(private i18nSrv: NaI18NService) {} get change(): Observable { return this._change$.pipe(share()); } getPathByUrl(url: string): NaMenu[] { return null; } ngOnDestroy(): void { if (this._change$) { this._change$.unsubscribe(); } if (this.i18n$) { this.i18n$.unsubscribe(); } } }