Open History to see the last commit
1# TanStack Angular Query Simple Example
2β
3Fetches a single GitHub repository and shows its stats.
4β
5## How it works
6β
7- `src/app/components/simple-example.component.ts` calls `injectQuery` with `queryKey: ['repoData']` and a `queryFn` that fetches the `TanStack/query` repository with `HttpClient` and converts it with `lastValueFrom`.
8- `src/app/components/simple-example.component.html` renders from the query's signals: `isPending()`, `isError()` with `error()`, and `data()` for the repository's name, description and counts.
9- `src/app/app.config.ts` registers a `QueryClient` with `provideTanStackQuery` and `withDevtools()`, and provides `HttpClient` with `provideHttpClient(withFetch())`.
10β
11To run this example:
12β
13- `npm install`
14- `npm start`