File

test/fixtures/sample-files/query-param-group.service.ts

Description

Service implementing the synchronization logic

This service is the key to the synchronization process by binding a QueryParamGroup to the router.

Index

Properties
Methods
Accessors

Constructor

constructor(routerAdapter: RouterAdapter, globalRouterOptions: RouterOptions)
Parameters :
Name Type Optional
routerAdapter RouterAdapter No
globalRouterOptions RouterOptions No

Methods

Public deregisterQueryParamDirective
deregisterQueryParamDirective(queryParamName: string)

Deregisters a QueryParamAccessor by referencing its name.

Parameters :
Name Type Optional
queryParamName string No
Returns : void
Private deserialize
deserialize(queryParam: QueryParam, values: string | string[])
Type parameters :
  • T
Parameters :
Name Type Optional
queryParam QueryParam<T> No
values string | string[] No
Returns : Unpack | []
Private enqueueNavigation
enqueueNavigation(data: NavigationData)

Sends a change of parameters to the queue.

Parameters :
Name Type Optional
data NavigationData No
Returns : void
Private getParamsForValue
getParamsForValue(queryParam: QueryParam, value: T | undefined | null)
Type parameters :
  • T

Returns the full set of parameters given a value for a parameter model.

This consists mainly of properly serializing the model value and ensuring to take side effect changes into account that may have been configured.

Parameters :
Name Type Optional
queryParam QueryParam<any> No
value T | undefined | null No
Returns : Params
Private isSyntheticNavigation
isSyntheticNavigation()

Returns true if the current navigation is synthetic.

Returns : boolean
Private navigateSafely
navigateSafely(data: NavigationData)
Parameters :
Name Type Optional
data NavigationData No
Returns : Observable<any>
Public registerQueryParamDirective
registerQueryParamDirective(directive: QueryParamAccessor)

Registers a QueryParamAccessor.

Parameters :
Name Type Optional
directive QueryParamAccessor No
Returns : void
Private serialize
serialize(queryParam: QueryParam, value: T)
Type parameters :
  • T
Parameters :
Name Type Optional
queryParam QueryParam<any> No
value T No
Returns : string | []
Public setQueryParamGroup
setQueryParamGroup(queryParamGroup: QueryParamGroup)

Uses the given QueryParamGroup for synchronization.

Parameters :
Name Type Optional
queryParamGroup QueryParamGroup No
Returns : void
Private setupGroupChangeListener
setupGroupChangeListener()

Listens for programmatic changes on group level and synchronizes to the router.

Returns : void
Private setupNavigationQueue
setupNavigationQueue()

Subscribes to the parameter queue and executes navigations in sequence.

Returns : void
Private setupParamChangeListener
setupParamChangeListener(queryParamName: string)
Parameters :
Name Type Optional
queryParamName string No
Returns : void
Private setupParamChangeListeners
setupParamChangeListeners()

Listens for programmatic changes on parameter level and synchronizes to the router.

Returns : void
Private setupRouterListener
setupRouterListener()

Listens for changes in the router and synchronizes to the model.

Returns : void
Private startSynchronization
startSynchronization()
Returns : void
Private watchNewParams
watchNewParams()

Listens for newly added parameters and starts synchronization for them.

Returns : void

Properties

Private directives
Type : unknown
Default value : new Map<string, QueryParamAccessor[]>()

List of QueryParamAccessor registered to this service.

Private queryParamGroup
Type : QueryParamGroup

The QueryParamGroup to bind.

Private queue$
Type : unknown
Default value : new Subject<NavigationData>()

Queue of navigation parameters

A queue is used for navigations as we need to make sure all parameter changes are executed in sequence as otherwise navigations might overwrite each other.

Accessors

routerOptions
getrouterOptions()

Returns the current set of options to pass to the router.

This merges the global configuration with the group specific configuration.

Returns : RouterOptions

results matching ""

    No results matching ""