* Called by the host directive's OnInit hook. Reads the initial state of the * form and overrides it with persisted state from previous openings, if * applicable.
(previousFormValue: FormValue | undefined)
| 45 | * applicable. |
| 46 | */ |
| 47 | init(previousFormValue: FormValue | undefined): void { |
| 48 | // Wait for the next render before caching the initial value. |
| 49 | // This ensures that all form controls have been initialized. |
| 50 | afterNextRender( |
| 51 | () => { |
| 52 | this.updateRevertValue(); |
| 53 | if (previousFormValue) { |
| 54 | this.reset(previousFormValue); |
| 55 | } |
| 56 | }, |
| 57 | {injector: this._injector}, |
| 58 | ); |
| 59 | } |
| 60 | |
| 61 | ngOnDestroy(): void { |
| 62 | this._editEventDispatcher.unsetActiveEditRef(this); |
no test coverage detected