我无法将动态创建的 material 输入字符串插入 angular 中的网页

Im having trouble with inserting dynamically created material input string to web page in angular

下面是代码,我在其中生成一个文本区域 material 输入以及一个值,并将其插入到名为 child_2 的 div 中。问题是它加载默认 HTML Textarea 并且里面也没有加载值。

      const box = document.getElementById(cmt_id);

        const child_1 = box.children[0];
        const child_2 = box.children[1];
        let comment_text = child_1.innerHTML;

        let inputText = `
          <mat-form-field appearance="outline" class="w-100">
          <textarea
          matInput 
          matTextareaAutosize 
          [matAutosizeMinRows]="2" 
          [matAutosizeMaxRows]="6"
          class="comment" 
          (keyup.enter)="updateComment($event.target.value, ct.id)"
          [(value)]="${comment_text}"
          ></textarea>
          </mat-form-field>
          `;
          child_2.innerHTML = inputText;

此代码如图所示。

生成了文本区域输入。 请帮助!

@ViewChildren("textField") 文本字段:查询列表;

尝试在 angular...

中理解这个概念