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?: MutationFilters<unknown, Error, unknown, unknown>, 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[`MutationFilters`](../interfaces/MutationFilters.md)\<`unknown`, `Error`, `unknown`, `unknown`\>
22β
23The [MutationFilters](../interfaces/MutationFilters.md) to narrow down the matched mutations.
24β
25<a id="filters-properties"></a>
26β
27#### `filters` properties
28β
29| Property | Type | Description |
30| ------ | ------ | ------ |
31| <a id="filters-property-exact"></a> `exact?` | `boolean` | Match mutation key exactly |
32| <a id="filters-property-mutationkey"></a> `mutationKey?` | readonly `unknown`[] | Include mutations matching this mutation key |
33| <a id="filters-property-predicate"></a> `predicate?` | (`mutation`: [`Mutation`](../classes/Mutation.md)\<`TData`, `TError`, `TVariables`, `TOnMutateResult`\>) => `boolean` | Include mutations matching this predicate function |
34| <a id="filters-property-status"></a> `status?` | `"error"` \| `"pending"` \| `"success"` \| `"idle"` | Filter by mutation status |
35β
36### options?
37β
38[`InjectIsMutatingOptions`](../interfaces/InjectIsMutatingOptions.md)
39β
40Additional configuration
41β
42<a id="options-properties"></a>
43β
44#### `options` properties
45β
46| Property | Type | Description |
47| ------ | ------ | ------ |
48| <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`). |
49β
50## Returns
51β
52`Signal`\<`number`\>
53β
54A `Signal` with the number of mutations that your application currently has `pending`.
55β
56## Example
57β
58```angular-ts
59@Component({
60 selector: 'posts-mutating-indicator',
61 template: `
62 @if (isMutatingPosts()) {
63 <span>Saving posts...</span>
64 }
65 `,
66})
67export class PostsMutatingIndicator {
68 // How many mutations matching the posts prefix are in progress?
69 readonly isMutatingPosts = injectIsMutating({ mutationKey: ['posts'] })
70}
71```