Below is the code that creates an angular19 reusable resource loader and its usage with a single request parameter:
import { ResourceLoaderParams } from "@angular/core";
function todoLoader({ request: todoId, abortSignal }: ResourceLoaderParams<number>): Promise<Todo> {
return fetch(
`https://jsonplaceholder.typicode.com/todos/${todoId}`,
{ signal: abortSignal }
).then((res) => res.json() as Promise<Todo>);
}
todoResource = resource({ request: this.todoId, loader: todoLoader });
My difficulty is that I cannot find a way to have two (2) request parameters. I would like to add a second parameter 'appName' of type 'string' to the request parameter.
Appreciate your help