Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: update routing documentation to describe forRoot setup #2325

Merged
merged 1 commit into from
Oct 23, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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``
cpaulve-1A marked this conversation as resolved.
Show resolved Hide resolved
* 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
Loading