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, "status">): Signal<number>;
10```
11β
12Defined in: [packages/angular-query/src/inject-is-mutating.ts:30](https://github.com/TanStack/query/blob/main/packages/angular-query/src/inject-is-mutating.ts#L30)
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), `"status"`\>
22β
23A function returning the [MutationFilters](../interfaces/MutationFilters.md) to narrow down the matched mutations.
24Similar to `computed` from Angular, this function runs in the reactive context, so signals read inside it
25re-narrow the matched mutations.
26β
27<a id="filters-properties"></a>
28β
29#### `filters` properties
30β
31Built from [`MutationFilters`](../interfaces/MutationFilters.md#properties). See the type above for what it changes.
32β
33## Returns
34β
35`Signal`\<`number`\>
36β
37A `Signal` with the number of mutations that your application currently has `pending`.
38β
39## Example
40β
41```angular-ts
42@Component({
43 selector: 'posts-mutating-indicator',
44 template: `
45 @if (isMutatingPosts()) {
46 <span>Saving posts...</span>
47 }
48 `,
49})
50export class PostsMutatingIndicator {
51 // How many mutations matching the posts prefix are in progress?
52 readonly isMutatingPosts = injectIsMutating(() => ({ mutationKey: ['posts'] }))
53}
54```