Skip to content

Latest commit

 

History

History
52 lines (34 loc) · 1.79 KB

how-to-close-view.md

File metadata and controls

52 lines (34 loc) · 1.79 KB

SCION Workbench

SCION Workbench Projects Overview Changelog Contributing Sponsoring

How to close a view

A view can be closed via the view's handle WorkbenchView, the WorkbenchService, or the WorkbenchRouter.

Closing a view using its handle

Inject WorkbenchView handle and invoke the close method.

import {inject} from '@angular/core';
import {WorkbenchView} from '@scion/workbench';

inject(WorkbenchView).close();

Closing view(s) using the WorkbenchService

Inject WorkbenchService and invoke closeViews, passing the ids of the views to close.

import {inject} from '@angular/core';
import {WorkbenchService} from '@scion/workbench';

inject(WorkbenchService).closeViews('view.1', 'view.2');

Closing view(s) via WorkbenchRouter

The router supports for closing views matching the routing commands by setting close in navigation extras.

Matrix parameters do not affect view resolution. The path supports the asterisk wildcard segment (*) to match views with any value in a segment. To close a specific view, set a view target instead of a path.

import {inject} from '@angular/core';
import {WorkbenchRouter} from '@scion/workbench';

inject(WorkbenchRouter).navigate(['path/*/view'], {close: true});