Skip to content

Suite Module Routing

When developing a suite application, it is the application that will configure all modules that are used.

It does so in its routing configuration: it configures which modules are served at which path.

For that to happen, each module exposes a function called createSomeModuleRoute which the application will use to create a route for that module.

Routing to self

When developing a module, we want to be able to route to different views of our own module: say route from a "list page" to the "creation page".

To do that we use the SuiteRouter.navigateToSelf method. It receives a list of paths to form an URL, like Angular's Router does.

TypeScript
1
2
3
4
5
// navigates to the root of this module. i.e ''
this.router.navigateToSelf();

// navigates to /where-ever-this-module-is-hosted/new
this.router.navigateToSelf(['new']);

Routing to other modules

To route to a different module, we need to know its module id. All modules expose their id under their public API so that other modules can use it to navigate to that module.

We can use the SuiteRouter.navigateTo which receives a module id and the path to navigate to.

TypeScript
1
2
3
4
import { ADMIN_CENTER_ISSUES } from '@admin-center/issues';

// navigates to /where-ever-issue-module-is-hosted/new
this.router.navigateTo(ADMIN_CENTER_ISSUES, ['new']);