Angular - Form Array push specific index

前端 未结 1 1459
北恋
北恋 2021-01-02 04:08
addStop() {
    const control = this.editForm.controls[\'stops\'];
    control.push(this.initStop());
}

I have this code to add a

1条回答
  •  暗喜
    暗喜 (楼主)
    2021-01-02 04:32

    Use FormArray#insert:

    control.insert(, this.initStop());
    

    0 讨论(0)
提交回复
热议问题