How to remove multiple item from FormArray
Call Method at any component :-
this.removeItems(formArray, formcontrolCountryID, 2);
Method Defination :-
removeItems(formArray, formcontrolCountryID, TypeID) {
const items: any = formArray.value.filter(x => x.CountryID == formcontrolCountryID.value && x.TypeID == TypeID);
if (items && items.length > 0) {
formArray.controls.forEach((element, j) => {
if (element.get('CountryID').value == formcontrolCountryID.value && element.get('TypeID').value == TypeID) {
formArray.removeAt(j);
}
});
this.removeItems(formArray, formcontrolCountryID, TypeID);
}
}