How can i add several columns if i add the "click here to add transportation field" like i want to add driver, contact number etc.... Once you click the modal, it will show you some options on what field to add. Please check the code link that I've made. here's also my codes below. Please check also the image here
CHECK THIS LINK https://stackblitz.com/edit/dynamic-columns-reactive-forms-hj5nur?file=app/app.component.ts
openModal(template: TemplateRef < any > ) {
this.modalRef = this.modalService.show(template);
}
initGroup() {
let rows = this.addForm.get('rows') as FormArray;
rows.push(this.fb.group({
description: [null, Validators.required],
pickup_area: [null, Validators.required],
pickup_time: [null, Validators.required],
sign_board: [null, Validators.required],
driver: [null],
contact_number: [null],
transportation_unit: [null],
special_instructions: [null],
}))
}
here is the edited stackblitz : https://stackblitz.com/edit/dynamic-columns-reactive-forms-d3xsnf?file=app%2Fapp.component.html
this link contains validation too :