How to add more input fields using a button - Angular 2 dynamic forms
<p>So I used the guide here: <a href="https://angular.io/docs/ts/latest/cookbook/dynamic-form.html" rel="noreferrer">https://angular.io/docs/ts/latest/cookbook/dynamic-form.html</a></p>

<p>I need to add more fields to an existing field. I've made something that works, but it's clunky and it resets the form when I hit it. Code below:</p>

<p>In dynamic-form.component.ts:</p>

<pre><code>add_textbox()
{
    this.questions.push(this.questionService.create_textbox({key: "test", label: "Test"}));
    console.log(this.questions);
    this.form = this.qcs.toFormGroup(this.questions);
}
</code></pre>

<p>In question.service.ts</p>

<pre><code>create_textbox({key, value, label = '', order = 1, type = "text", description = "", help = ""}: {key?: any, value?: any, label?: any, order?: any, type?: any, description?: any, help?: any})
{
    return new TextboxQuestion({
        key,
        label,
        value,
        order,
        description,
        type
    });
}
</code></pre>

<p>My button is also in <code>dynamic-form.component.html</code> but I'd like it to be in <code>dynamic-form-question.component.ts</code> instead. Is this possible?</p>