Browse Source

default layout token added

fix/#23795
erdemcaygor 4 months ago
parent
commit
baf3d9a270
  1. 4
      npm/ng-packs/packages/core/src/lib/components/dynamic-layout.component.ts
  2. 4
      npm/ng-packs/packages/core/src/lib/tokens/default-layout.token.ts
  3. 1
      npm/ng-packs/packages/core/src/lib/tokens/index.ts

4
npm/ng-packs/packages/core/src/lib/components/dynamic-layout.component.ts

@ -14,6 +14,7 @@ import { DYNAMIC_LAYOUTS_TOKEN } from '../tokens/dynamic-layout.token';
import { EnvironmentService } from '../services';
import { NgComponentOutlet } from '@angular/common';
import { filter, take } from 'rxjs';
import { DEFAULT_LAYOUT } from '../tokens';
@Component({
selector: 'abp-dynamic-layout',
@ -39,6 +40,7 @@ export class DynamicLayoutComponent {
protected readonly subscription = inject(SubscriptionService);
protected readonly routerEvents = inject(RouterEvents);
protected readonly environment = inject(EnvironmentService);
protected readonly defaultLayout = inject(DEFAULT_LAYOUT, { optional: true });
constructor() {
const dynamicLayoutComponent = inject(DynamicLayoutComponent, { optional: true, skipSelf: true });
@ -89,7 +91,7 @@ export class DynamicLayoutComponent {
break;
}
}
return expectedLayout;
return expectedLayout ?? this.defaultLayout;
}
showLayoutNotFoundError(layoutName: string) {

4
npm/ng-packs/packages/core/src/lib/tokens/default-layout.token.ts

@ -0,0 +1,4 @@
import { InjectionToken } from '@angular/core';
import { eLayoutType } from '@abp/ng.core';
export const DEFAULT_LAYOUT = new InjectionToken<eLayoutType>('');

1
npm/ng-packs/packages/core/src/lib/tokens/index.ts

@ -18,3 +18,4 @@ export * from './compare-func.token';
export * from './dynamic-layout.token';
export * from './title-strategy-disable-project-name.token';
export * from './ssr-state.token';
export * from './default-layout.token';

Loading…
Cancel
Save