-
Notifications
You must be signed in to change notification settings - Fork 47
Expand file tree
/
Copy pathcounter-mutation-functions.html
More file actions
44 lines (38 loc) · 1.17 KB
/
counter-mutation-functions.html
File metadata and controls
44 lines (38 loc) · 1.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
<h1>rxMutation + httpMutation (without Store)</h1>
<div class="counter">{{ counter() }}</div>
<section>
<h2>Local Increment (rxMutation)</h2>
<ul>
<li>isPending: {{ isPending() }}</li>
<li>Status: {{ status() }}</li>
<li>Error: {{ error() | json }}</li>
<li>Value: {{ value() | json }}</li>
<li>hasValue: {{ hasValue() }}</li>
</ul>
<div>
<button type="button" (click)="incrementCounter()" [disabled]="isPending()">
@if (isPending()) { Incrementing... } @else { Increment by 1 }
</button>
<button type="button" (click)="incrementBy13()" [disabled]="isPending()">
@if (isPending()) { Incrementing... } @else { Increment by 13 }
</button>
</div>
</section>
<section>
<h2>Send to Server (httpMutation)</h2>
<ul>
<li>isPending: {{ saveIsPending() }}</li>
<li>Status: {{ saveStatus() }}</li>
<li>Error: {{ saveError() | json }}</li>
<li>lastResponse: {{ lastResponse() | json }}</li>
</ul>
<div>
<button
type="button"
(click)="saveCounterToServer()"
[disabled]="saveIsPending()"
>
@if (saveIsPending()) { Sending to Server... } @else { Send to Server }
</button>
</div>
</section>