It appears that a similar issue was discussed in this Stack Overflow thread, however, I am specifically seeking a solution using Angular
instead of AngularJS
.
Within my Reactive Forms, I have implemented validators as shown:
public contactForm: FormGroup = this.formBuilder.group({
...
formControlDescription: [
'',
Validators.compose([
Validators.maxLength(5000),
Validators.minLength(30),
Validators.required,
]),
],
...
});
In the html
file, I currently have the number 5000
hardcoded like this:
<mat-hint align="end">{{ contactForm.get('formControlDescription')!.value.length }} / 5000</mat-hint>
Question: Is there a way to dynamically access and display the Validators.maxLength(5000)
for formControlDescription
from contactForm
in the html
?