I have this editor
<div id="editor"></div>
setting its value to form control.
this.FrmGroup.get("name").setValue(this.quill.root.innerHTML)`
<div *ngIf="FrmGroup.get('name').invalid && (FrmGroup.get('name').dirty || FrmGroup.get('name').touched)">
<small class="validation-error">Please provide a name.</small>
</div>
The value is empty but the error is not shown.
Form group Structure:
this.FrmGroup = this.fb.group({
name: ['', Validators.required],
Description: ['', Validators.required],
});
The problem is in here:
which the HTML element is rendered only by fulfilling:
Either:
You should mask the form control dirty or touched after setting the value.
Demo @ StackBlitz
Or remove the logic for checking the form control is dirty or touched if it is not required.