Search code examples
htmlangularangular6contenteditableangular-forms

Contenteditable div , get form value options angular7


Can I get true/false when I am typing content ? I have to show/hide submit button by using *ngIf option ?

When I am using form we use this form.controls['name'].dirty it should be true or false

My code stackblit

<h5 contenteditable="true"(input)="issueTitle=$event.target.textContent" #titletag>Test </h5>
<button *ngIf="">submit</button>

Solution

  • You can try like this.

    HTML

    <h5 contenteditable="true" (keyup)="onKey($event)"> Test </h5>
    <button *ngIf="isSubmitShow">submit</button>
    

    TS

    isSubmitShow: boolean = true;
    onKey(data) {
     this.isSubmitShow = !this.isSubmitShow;
    }