Skip to content

Commit 0b81480

Browse files
author
The Ult
committed
fix(directives): implement AfterViewInit lifecycle hook in FormDirective
Fixes ValidationConfig issue simplifiedcourses#14 See: simplifiedcourses#16
1 parent 4823aba commit 0b81480

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

projects/ngx-vest-forms/src/lib/directives/form.directive.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* eslint-disable @typescript-eslint/no-explicit-any */
2-
import { Directive, inject, input, OnDestroy, Output } from '@angular/core';
2+
import { Directive, inject, input, OnDestroy, Output, AfterViewInit } from '@angular/core';
33
import { toObservable } from '@angular/core/rxjs-interop';
44
import {
55
AsyncValidatorFn,
@@ -42,7 +42,7 @@ import { ValidationOptions } from './validation-options';
4242
selector: 'form[scVestForm]',
4343
standalone: true,
4444
})
45-
export class FormDirective<T extends Record<string, any>> implements OnDestroy {
45+
export class FormDirective<T extends Record<string, any>> implements OnDestroy, AfterViewInit {
4646
public readonly ngForm = inject(NgForm, { self: true, optional: false });
4747

4848
/**
@@ -167,7 +167,7 @@ export class FormDirective<T extends Record<string, any>> implements OnDestroy {
167167
}>
168168
> = {};
169169

170-
public constructor() {
170+
public ngAfterViewInit() {
171171
// When the validation config changes
172172
// Listen to changes of the left-side of the config and trigger the updateValueAndValidity
173173
toObservable(this.validationConfig)

0 commit comments

Comments
 (0)