segments Property Optional

A function that generates an array of route segments from the provided params

@param params: Record<keyof P, string>
A record of param keys and their corresponding values

@returns string[]
An array of route segments

API

segments?: (params: Record<keyof P, string>) => string[];

Example

import {routeGroup} from '@bitfiber/ng/rx';
 
// Provides a route group
const route = routeGroup<{id: number; type: string}>({
  initialParams: {id: 0, type: 'all'},
  // Generates an array of route segments from the provided params 
  segments: params => [params.type, params.id],
});