ngx-form-draft 2.1.0 → 2.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +33 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -38,22 +38,37 @@ export class AppModule {}
|
|
|
38
38
|
|
|
39
39
|
## Usage
|
|
40
40
|
|
|
41
|
-
###
|
|
41
|
+
### Reactive Forms
|
|
42
42
|
|
|
43
43
|
```html
|
|
44
44
|
<form [formGroup]="myForm" ngxFormDraft="uniqueFormId">
|
|
45
|
-
|
|
45
|
+
<input formControlName="name">
|
|
46
|
+
<input formControlName="email">
|
|
46
47
|
</form>
|
|
47
48
|
```
|
|
48
49
|
|
|
49
|
-
###
|
|
50
|
+
### Template-driven Forms
|
|
50
51
|
|
|
51
52
|
```html
|
|
53
|
+
<form #myForm="ngForm" ngxFormDraft="uniqueFormId">
|
|
54
|
+
<input name="name" [(ngModel)]="model.name">
|
|
55
|
+
<input name="email" [(ngModel)]="model.email">
|
|
56
|
+
</form>
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
### Scoped drafts (per entity)
|
|
60
|
+
|
|
61
|
+
```html
|
|
62
|
+
<!-- Reactive -->
|
|
52
63
|
<form [formGroup]="editForm" [ngxFormDraft]="'edit_' + userId">
|
|
64
|
+
|
|
65
|
+
<!-- Template-driven -->
|
|
66
|
+
<form #editForm="ngForm" [ngxFormDraft]="'edit_' + userId">
|
|
53
67
|
```
|
|
54
68
|
|
|
55
69
|
## Options
|
|
56
70
|
|
|
71
|
+
### Reactive Forms
|
|
57
72
|
```html
|
|
58
73
|
<form
|
|
59
74
|
[formGroup]="myForm"
|
|
@@ -68,6 +83,21 @@ export class AppModule {}
|
|
|
68
83
|
</form>
|
|
69
84
|
```
|
|
70
85
|
|
|
86
|
+
### Template-driven Forms
|
|
87
|
+
```html
|
|
88
|
+
<form
|
|
89
|
+
#myForm="ngForm"
|
|
90
|
+
[ngxFormDraft]="'myForm_' + entityId"
|
|
91
|
+
[draftDebounce]="1000"
|
|
92
|
+
[draftExcludeFields]="['password', 'confirmPassword']"
|
|
93
|
+
[draftShowOnChange]="true"
|
|
94
|
+
[draftRestoredText]="'Draft restored'"
|
|
95
|
+
[draftSavedText]="'Draft saved'"
|
|
96
|
+
[draftSavedLabel]="'saved'"
|
|
97
|
+
[draftDiscardText]="'Discard'">
|
|
98
|
+
</form>
|
|
99
|
+
```
|
|
100
|
+
|
|
71
101
|
### Input Properties
|
|
72
102
|
|
|
73
103
|
- `ngxFormDraft` (string): Unique form identifier
|