1

I have used a markdown editor in my angular HTML file form as follows:

        <td-text-editor class="full-width" formControlName="description"></td-text-editor>

In the form, if we leave the description empty, it should throw up an error. Any inputs?

1 Answers1

0

Just add a required validator to your formControl then you can show the errors for that formControl on your template

this.myform = new FormGroup({
'description': new FormControl(this.hero.power, Validators.required)
});

On your template

<input id="name" class="form-control"
      formControlName="description" required >

<div *ngIf="description.invalid && (description.dirty || description.touched)"
    class="alert alert-danger">

  <div *ngIf="name.errors.required">
    Description is required.
  </div>
Nico
  • 1,961
  • 17
  • 20