Skip to content
qubeejs/angular
API/provideQubeeRouterAdapter

provideQubeeRouterAdapter

function@qubeejs/angular/routerrouter/src/provide-qubee-router-adapter.ts

Provide an adapter that reads and writes the URL through the Angular Router

Lists navigate with router.navigateByUrl() and follow every navigation, theirs or not — Back, Forward, a routerLink elsewhere. Provide it once, next to provideRouter():

bootstrapApplication(AppComponent, {
providers: [provideRouter(routes), provideQubeeRouterAdapter()]
});

A list’s location moves to the incoming URL as soon as the router has resolved it, before the routed components are created, so a list injected in one of them starts from the URL it was navigated to. A navigation that is cancelled or fails moves it back.

Render links to list states with routerLink; a plain [href] reloads the page. From Angular 18.1 it takes a UrlTree — [routerLink]="router.parseUrl(list.href({ page: 2 }))"; before, pass the query on its own — [routerLink]="[]" with [queryParams]="router.parseUrl(list.href({ page: 2 })).queryParams".

provideQubeeRouterAdapter(): Provider[]

Returns — The provider for QUBEE_LIST_ADAPTER