我有一个存储对一个未定义的数字形式:标签/值:角2追加点击按钮
<form (submit)=new_answers_for_this_question()>
<div class="row">
<div class="input-field col m5">
<input placeholder="Label" id="label" type="text" class="validate">
</div>
<div class="input-field col m5">
<input placeholder="Value" id="values" type="text" class="validate">
</div>
<div class="input-field col m2 center-align">
<button class="btn-floating waves-effect waves-light" (click)="new_answer()"><i class="material-icons">add</i></button>
</div>
</div>
<button>Insert Answers</button>
</form>
我只是想填补这两个输入,然后按add button
添加一个新行用新的标签/值input
,之前的add button
会消失,并且新增一个新按钮来追加新的可能的行。使用jQuery
很简单,因为append
父div上的整行div,但使用角度我不知道如何处理这个问题,¿任何想法?
编辑:其目的是为DataBase中相同问题的每对标签和值插入一行。
即:
**Question 1**
Label: 'good', value: '7-10'
Label: 'neutral', Value: '4-6'
Label: 'bad', Value: '1-3'
使用循环('* ngFor')在用户按下“添加”时添加项目的数组上。 – 2017-06-05 12:26:01
但第一次我需要一个输入,第一次循环时将是空的,然后没有输入显示 – PriNcee