Skip to content

Commit

Permalink
chore: update routing documentation to describe forRoot setup
Browse files Browse the repository at this point in the history
  • Loading branch information
cpaulve-1A committed Oct 22, 2024
1 parent ad852e3 commit a353127
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions docs/routing/APP_SERVER_ROUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
// ...
Expand All @@ -11,8 +14,8 @@ import {AppServerRoutingModule} from '@o3r/routing';

@NgModule({
imports: [
// ...
AppServerRoutingModule,
// ...
AppServerRoutingModule.forRoot(environment),
// ...
],
// ...
Expand All @@ -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

0 comments on commit a353127

Please sign in to comment.