Angular 2: Accessing data from FormArray

前端 未结 4 1056
生来不讨喜
生来不讨喜 2021-01-31 16:23

I have prepared a from using ReactiveForms provided by angular2/forms. This form has a form array products:

this.checkoutFormGroup = this.fb.group({
                     


        
4条回答
  •  故里飘歌
    2021-01-31 16:54

    Just cast that control to array

    var arrayControl = this.checkoutFormGroup.get('products') as FormArray;
    

    and all its features are there

    var item = arrayControl.at(index);
    

提交回复
热议问题