From a353127856957b6c598578a6f76ee05a28f231fb Mon Sep 17 00:00:00 2001 From: Corinne PAULVE Date: Tue, 22 Oct 2024 18:36:32 +0200 Subject: [PATCH] chore: update routing documentation to describe forRoot setup --- docs/routing/APP_SERVER_ROUTING.md | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/docs/routing/APP_SERVER_ROUTING.md b/docs/routing/APP_SERVER_ROUTING.md index 49c6b7a5e9..03a3ed05d8 100644 --- a/docs/routing/APP_SERVER_ROUTING.md +++ b/docs/routing/APP_SERVER_ROUTING.md @@ -2,7 +2,10 @@ In order to get Angular routing redirection to work correctly, you have to correctly provide the ``APP_BASE_HREF`` token from ``@angular/common``. To ease this process, we have created a new routing module to handle this provider together with some useful shell commands. -In your app, you just need to import the ``AppServerRoutingModule`` from ``@o3r/routing``. Example: +In your app, you just need to import the ``AppServerRoutingModule`` from ``@o3r/routing`` and configure it with your `environment` +which should be an instance of `@o3r/core` `BuildTimeProperties`. + +Example: ```typescript // ... @@ -11,8 +14,8 @@ import {AppServerRoutingModule} from '@o3r/routing'; @NgModule({ imports: [ - // ... - AppServerRoutingModule, + // ... + AppServerRoutingModule.forRoot(environment), // ... ], // ... @@ -21,6 +24,7 @@ export class AppModule {} ``` By default, the ``APP_BASE_HREF`` will be provided using one of the following items (by priority): - * Disabled if it's not the PROD environment + * Disabled if it's not the PROD environment (`environment.ENVIRONMENT` === 'prod') * the content of ``data-appbasehref`` attribute of ``body`` + * the value of ``environment.APP_BASE_HREF`` * the value of ``--app-base-href`` cli option is passed in the build. If the value is not passed, ``APP_BASE_HREF`` will be disabled