From c0896e6806660bf894cf480a4abcd4210cd1b88b Mon Sep 17 00:00:00 2001 From: mehmet-erim Date: Fri, 19 Jun 2020 14:22:03 +0300 Subject: [PATCH] feat: check dynamic layout other instance --- .../core/src/lib/components/dynamic-layout.component.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/npm/ng-packs/packages/core/src/lib/components/dynamic-layout.component.ts b/npm/ng-packs/packages/core/src/lib/components/dynamic-layout.component.ts index 5455187086..d2248550d8 100644 --- a/npm/ng-packs/packages/core/src/lib/components/dynamic-layout.component.ts +++ b/npm/ng-packs/packages/core/src/lib/components/dynamic-layout.component.ts @@ -1,4 +1,4 @@ -import { Component, Injector, OnDestroy, Type } from '@angular/core'; +import { Component, Injector, OnDestroy, Type, Optional, SkipSelf } from '@angular/core'; import { ActivatedRoute, NavigationEnd, Router } from '@angular/router'; import { Store } from '@ngxs/store'; import { eLayoutType } from '../enums/common'; @@ -28,7 +28,10 @@ export class DynamicLayoutComponent implements OnDestroy { private route: ActivatedRoute, private routes: RoutesService, private store: Store, + @Optional() @SkipSelf() dynamicLayoutComponent: DynamicLayoutComponent, ) { + if (dynamicLayoutComponent) return; + const router = injector.get(Router); const layouts = { application: this.getComponent('Theme.ApplicationLayoutComponent'),