ngx-form-draft 2.2.5 → 2.2.9

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.
Files changed (2) hide show
  1. package/README.md +23 -0
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -116,6 +116,29 @@ export class AppModule {}
116
116
  - `draftSavedLabel` (string): Label before timestamp
117
117
  - `draftDiscardText` (string): Discard button text
118
118
 
119
+ ## Clearing the draft
120
+
121
+ The draft is not cleared automatically on form submit. To clear it (e.g. after a successful submit), use **FormDraftService** — the same for both reactive and template-driven forms.
122
+
123
+ Inject the service and call `clear(formId)` with the same `formId` you use on the form:
124
+
125
+ ```typescript
126
+ import { FormDraftService } from 'ngx-form-draft';
127
+
128
+ export class MyComponent {
129
+ constructor(private draftService: FormDraftService) {}
130
+
131
+ onSubmit() {
132
+ this.myForm.markAllAsTouched();
133
+ if (this.myForm.invalid) return;
134
+ // ... submit to API ...
135
+ this.draftService.clear('uniqueFormId'); // same id as ngxFormDraft
136
+ }
137
+ }
138
+ ```
139
+
140
+ Users can also clear the draft at any time via the banner’s **Discard** button.
141
+
119
142
  ## Internationalization (i18n)
120
143
 
121
144
  The package has **zero dependencies** and supports any i18n solution. Just pass translated strings via inputs:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ngx-form-draft",
3
- "version": "2.2.5",
3
+ "version": "2.2.9",
4
4
  "description": "Auto-save and restore Angular form drafts with zero dependencies",
5
5
  "author": "Neokyuubi",
6
6
  "publishConfig": {