如何获取打字稿中动态选择的输入的值
<ion-list *ngFor="let specs of spec;let i = index">
<ion-item>
<ion-label stacked>
{{specs.title}}
</ion-label>
<ion-input type="text" value="{{specs.t_value}}"
[(ngModel)]="specification[i]" name="specification"></ion-input>
</ion-item>
</ion-list>
答案 0 :(得分:0)
为动态字段尝试类似的操作
<form #myForm="ngForm">
<ion-list *ngFor="let specs of spec;let i = index">
<ion-item>
<ion-label stacked>
{{specs.title}}
</ion-label>
<ion-input type="text"[(ngModel)]="specs.t_value" #value="ngModel" name="specification[{{i}}]"></ion-input>
</ion-item>
</ion-list>
<button ion-button block color="primary" (click)="insert(myForm)">Save</button>
</form>