changeUrl Method

Updates the current URL by modifying the query params, route params, or fragment

@param data: Partial<Q | P>
A partial object containing the query or route params to update

@param fragment?: string
An optional string to update the URL fragment

API

changeUrl(data: Partial<Q | P>, fragment?: string): void;

Example

import {routeGroup} from '@bitfiber/ng/rx';
 
// Creates a route group
const route = routeGroup<{id: number; type: string}>({
  initialParams: {id: 0, type: 'all'},
});
 
// Initializes the group and all items within the group
route.initialize();
 
// Updates all states, such as the route params, query params and fragment
route.changeUrl({id: 2, type: 'new'}, 'someFragment');