私はangular2を使用しています。私のフォームでは、通常、モデルクラスを作成し、オブジェクトをフォームにバインドしてからthis.myObject経由でアクセスします。ngForのAngular2バインド配列
<div class="form-group ">
<label class="col-md-3 control-label">Label</label>
<div class="col-md-6">
<input type="text" class="form-control" [(ngModel)]="diplome.label" name="label">
</div>
</div>
以降
private diplome = new Diplome();
let myData = this.diplome;
を私のデータを取得し、私は*ngFor
を使用してデータの配列を示した位置に今の私、そしてクリックがそれらのすべてを取得するために提出するとき、私はしたいです特定のクラスの配列として返します。
...
<tr *ngFor="let inscription of inscriptions">
<td>
<span *ngIf="inscription._etudiant">{{ inscription._etudiant.label }}</span>
</td>
<td>
<div class="form-group ">
<div class="col-md-6">
<input type="number" class="form-control" name="note">
</div>
</div>
</td>
</tr>
...
バインディングを使用して、データが入力に挿入された刻印オブジェクトをすべての反復で取得できるようにします。
正確にどこで取得しますか? – micronyks
発射後、私のcomponent.tsの中にボタンを押してください。 – elhoucine