Open History to see the last commit
1---
2id: injectIsMutating
3title: injectIsMutating
4---
5β
6<!-- DO NOT EDIT: this page is autogenerated from the type comments -->
7β
8```ts
9function injectIsMutating(filters?: Omit<MutationFilters<unknown, Error, unknown, unknown>, "status">, options?: InjectIsMutatingOptions): Signal<number>;
10```
11β
12Defined in: [packages/angular-query-experimental/src/inject-is-mutating.ts:47](https://github.com/TanStack/query/blob/main/packages/angular-query-experimental/src/inject-is-mutating.ts#L47)
13β
14Injects a signal that tracks the number of mutations that your application currently has `pending`
15(useful for app-wide loading indicators).
16β
17## Parameters
18β
19### filters?
20β
21`Omit`\<[`MutationFilters`](../interfaces/MutationFilters.md)\<`unknown`, `Error`, `unknown`, `unknown`\>, `"status"`\>
22β
23The [MutationFilters](../interfaces/MutationFilters.md) to narrow down the matched mutations.
24β
25<a id="filters-properties"></a>
26β
27#### `filters` properties
28β
29Built from [`MutationFilters`](../interfaces/MutationFilters.md#properties). See the type above for what it changes.
30β
31### options?
32β
33[`InjectIsMutatingOptions`](../interfaces/InjectIsMutatingOptions.md)
34β
35Additional configuration
36β
37<a id="options-properties"></a>
38β
39#### `options` properties
40β
41| Property | Type | Description |
42| ------ | ------ | ------ |
43| <a id="options-property-injector"></a> `injector?` | `Injector` | The `Injector` in which to create the isMutating signal. If this is not provided, the current injection context will be used instead (via `inject`). |
44β
45## Returns
46β
47`Signal`\<`number`\>
48β
49A `Signal` with the number of mutations that your application currently has `pending`.
50β
51## Example
52β
53```angular-ts
54@Component({
55 selector: 'posts-mutating-indicator',
56 template: `
57 @if (isMutatingPosts()) {
58 <span>Saving posts...</span>
59 }
60 `,
61})
62export class PostsMutatingIndicator {
63 // How many mutations matching the posts prefix are in progress?
64 readonly isMutatingPosts = injectIsMutating({ mutationKey: ['posts'] })
65}
66```