This service is meant to be used to retain your request / post parameters. It is not a ngrx store. It is an Angular service which set a configured storage values
_query
and _post
, reading from
By default, sessionStorage. You can provide a custom Storage
, e.g. localStorage
.
Strategies available to read / write data in the RequestParameters service and storage.
Query parameters value you want to provide to the service
Post parameters value you want to provide to the service
In your application root config, provide your RequestParameters
configuration.
import {provideRequestParameters} from '@o3r/dynamic-content';
...
export const appConfig: ApplicationConfig = {
providers: [
// ...
provideRequestParameters()
]
}
Using custom configuration, must provide a factory function, returning a Partial<RequestParametersConfig>
:
import {provideRequestParameters, StorageStrategy} from '@o3r/dynamic-content';
...
/** We don't provide directly the value and use a factory because otherwise AOT compilation will resolve to undefined whatever is taken from window */
export function requestParametersConfiguration() {
return { storage: localStorage, strategy: StorageStrategy.Merge };
}
export const appConfig: ApplicationConfig = {
providers: [
// ...
provideRequestParameters(requestParametersConfiguration)
]
};