0

I have the following html. I want to add ace.js editor in my code and map the value in the Editor to answer field of the a form

  <div class="form-group" id="answer-div">
    <div class="label-div">
      <label class="control-label"><strong>Answer</strong></label>
    </div>
    <div  id="add-more-answer-div" class="two-column-grid">
      <div id="answer-filename-div">
        <label id="filename-label" for="answer-filename">Name</label>
        <input type="text" id="answer-filename">
        <button type="button" id="more-answer-button" class="unselected-button">Add More Sections</button>
      </div>
    </div>

    <div class="control-div" id="editor-div">
      <div id="editor" class="form-control" formControlName="answer" [ngClass]="validateField('answer')">Remove this and enter code here</div>
      <app-show-errors [control]="practiceQuestionForm.controls.answer"></app-show-errors>
    </div>
  </div>

The corresponding form is

    this.practiceQuestionForm = this.fb.group({
...
      answer:[null,Validators.required],
....
    })

When I run the code, I get the error Error: No value accessor for form control with name: 'answer' corresponding to html code <div id="editor" class="form-control" formControlName="answer" [ngClass]="validateField('answer')">Remove this and enter code here</div>

What am I doing wrong?

Manu Chadha
  • 15,555
  • 19
  • 91
  • 184

0 Answers0