我正在从api获取JSON
class
在文本部分,我得到两个问题,其中每个问题都有两个选项1和选项2的答案,这两个答案将写在输入字段中。如何获得动态创建的输入的值?我尝试将.val()
添加到每个输入,并尝试使用jQuery
通过 submitkey()
{
this.brandSelect = this.selectedOption;
this.stock_qty_innerwears_top = $('.INNERWEARS.TOP').val();
console.log(this.stock_qty_innerwears_top);
this.stock_qty_innerwears_bottom = $('.INNERWEARS.BOTTOM').val();
this.comfort_wear_top = $('.COMFORT.WEAR.TOP').val();
this.comfort_wear_bottom = $('.COMFORT.WEAR.BOTTOM').val();
let params={
eid:this.user.id,
brand:this.brandSelect,
type_col:'MARKET_WORKING',
STOCK_QTY_INNERWEARS_TOP:this.stock_qty_innerwears_top,
STOCK_QTY_INNERWEARS_BOTTOM:this.stock_qty_innerwears_bottom,
COMFORT_WEAR_TOP:this.comfort_wear_top,
COMFORT_WEAR_BOTTOM:this.comfort_wear_bottom,
}
this.apiService.add_mwork(params).subscribe((res)=>{
// console.log(res);
})
}
获取这些输入的值。但是,价值正在空白。没有得到如何用角度4做到这一点
下面是我的ts代码。
<div class="field-group" *ngFor="let mworkq of textq">
<div class="label-cust">
{{mworkq.Question}}
<ion-input class="{{mworkq.option1}}" type="text" placeholder="{{mworkq.option1}}" ></ion-input>
<ion-input class="{{mworkq.option2}}" type="text" placeholder="{{mworkq.option2}}" ></ion-input>
</div>
</div>
及以下是.html代码
ERROR in Error during template compile of 'AppModule'
Function calls are not supported in decorators but 'AnimateOnScrollModule' was called.