我從角2Angular2如果ngModel是一個表單標籤內使用,無論是名稱屬性必須設置或形式
core.umd.js:5995 EXCEPTION: Uncaught (in promise): Error: Error in app/model_exposure_currencies/model_exposure_currencies.component.html:57:18 caused by: If ngModel is used within a form tag, either the name attribute must be set or the form
control must be defined as 'standalone' in ngModelOptions.
Example 1: <input [(ngModel)]="person.firstName" name="first">
Example 2: <input [(ngModel)]="person.firstName" [ngModelOptions]="{standalone: true}">
<td *ngFor="let lag of ce.lags">
<div class="form-group1">
<input name="name" [(ngModel)]="lag.name" [ngModelOptions]="{standalone: true}" class="form-control" pattern="[0-9]*(\.[0-9]+)?" required>
</div>
</td>
收到此錯誤這是我如何使用表單標籤:
<form #f="ngForm" (ngSubmit)="onSubmit()">
這是爲我工作。每個[(ngModel)] =「」字段都必須有一個名稱。 –
只是我一直在尋找的答案。OP能否接受這是正確的答案。 –
文檔在哪裏? –