TypeScript. FormGroup FormArray - remove only one element object by value. Angular 2 4
FormArray
class has removeAt
which takes the index. If you do not know the index, you can do a workaround:
this.images.removeAt(this.images.value.findIndex(image => image.id === 502))
In Angular Reactive Forms, formArray
has a method called removeAt()
.
You can use it by passing an index that you want to delete:
delete(index){
this.array.removeAt(index)
}
``