垫子选择和垫子选项中的角度 html 错误



我正在尝试运行此代码

<mat-header-cell *matHeaderCellDef mat-sort-header class="header-primary-text"> Response </mat- header-cell>
<mat-cell *matCellDef="let element">
<!-- Code for new questions and dropdown - Ramki -->
<!-- mat-form-field style="width: 48%" -->
<div *ngIf="element.name == 'Select the complexity of Application'">
<mat-select [(ngModel)]="element.QuestionCode" placeholder="Select the complexity"
<mat-option *ngFor="let qc of element.QuestionCode" value="{{qc}}">
{{qc}} </mat-option>
</mat-select>
</div>

我收到如下错误:

意外的结束标记"垫选项"。当标签具有 已被另一个标记关闭。有关更多信息,请参阅 https://www.w3.org/TR/html5/syntax.html#closing-elements-that-have-implied-end-tags

("-option *ngFor="let qc of element.QuestionCode" value="{{qc}}">
{{qc}} [ERROR ->]</mat-option>
</mat-select>
</div>

我哪里出错了?

我是Angular的新手。任何帮助不胜感激

我遇到了类似的问题,我以这种方式修复了。它可能会帮助许多像我一样面临同样问题的人。

<div *ngIf="element.name == 'Select the complexity of Application'">
<mat-select [(ngModel)]='"element.QuestionCode"' placeholder="Select the complexity"
<mat-option *ngFor="let qc of element.QuestionCode" [value]='qc'>
{{qc}} </mat-option>
</mat-select>
</div>

最新更新