Skip to content

Latest commit

 

History

History
60 lines (49 loc) · 2.03 KB

how-to-configure-start-page.md

File metadata and controls

60 lines (49 loc) · 2.03 KB

SCION Workbench

SCION Workbench Projects Overview Changelog Contributing Sponsoring

How to configure a start page

A start page can be used to display content when all views are closed.

To display a start page, register an empty path route, as follows:

import {bootstrapApplication} from '@angular/platform-browser';
import {provideRouter} from '@angular/router';

bootstrapApplication(AppComponent, {
  providers: [
    provideRouter([
      {path: '', loadComponent: () => import('./start-page/start-page.component')},
    ]),
  ],
});

How to configure a start page per perspective

Different perspectives can have a different start page. Use the canMatchWorkbenchPerspective guard to match a route only if the specified perspective is active.

import {bootstrapApplication} from '@angular/platform-browser';
import {provideRouter} from '@angular/router';
import {canMatchWorkbenchPerspective} from '@scion/workbench';

bootstrapApplication(AppComponent, {
  providers: [
    provideRouter([
      // Match this route only if 'perspective-a' is active.
      {
        path: '',
        loadComponent: () => import('./perspective-a/start-page.component'),
        canMatch: [canMatchWorkbenchPerspective('perspective-a')],
      },
      // Match this route only if 'perspective-b' is active.
      {
        path: '',
        loadComponent: () => import('./perspective-b/start-page.component'),
        canMatch: [canMatchWorkbenchPerspective('perspective-b')],
      },
    ]),
  ],
});