Skip to content

Commit

Permalink
chore: update routing documentation to describe forRoot setup (#2325)
Browse files Browse the repository at this point in the history
## Related issues

Previous documentation was incomplete:
- the use case where the environment file provides the base href was
missing
- the developer / production context definition was missing
  • Loading branch information
cpaulve-1A authored Oct 23, 2024
2 parents 8559e3d + a353127 commit 994bfe8
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 994bfe8

Please sign in to comment.