How to iterate over FormArray in FormGroup in an Angular reactive Form

The Structure of my form is as shown below

The Structure of my form is as shown below

-MainForm(ParentForm)
 -FormGroup(MedicineGroup)
  -FormArray(MedicineArray)

I wanted to iterate MedicineArray for which, i did some research and wrote the below code

for (let control of soForm.get('MedicineGroup').controls['MedicineArray'].controls) {
    medObj.name.push(control.controls['MedName'].value);
  }

The code is working fine but i am getting a warning, which says

Property 'controls' does not exist on type 'AbstractControl'.

Is there any other or better way to iterate a FormArray which is inside a FormGroup?

Angular + Typescript = Powerful Web Apps

This presentation will cover the basics of Angular and the advantages of TypeScript – a language that adds features to JavaScript, including strong typing. You will learn about data binding, event binding, routing, and observables.


Thanks for watching ❤

If you liked this post, share it with all of your programming buddies!

Follow me on Facebook | Twitter

Learn More

Angular 8 (formerly Angular 2) - The Complete Guide

Angular & NodeJS - The MEAN Stack Guide

The Web Developer Bootcamp

Understanding TypeScript

Learn TypeScript From Scratch

What’s New in Angular 8.0

MEAN Stack Tutorial MongoDB, ExpressJS, AngularJS and NodeJS

Top 3 Useful TypeScript Tips for Angular

Angular + WebSocket + Node.js Express = RxJS WebSocketSubject ❤️