get beans() { return this.validateForm.get('beans') as FormArray; } change(fromIdx, toIdx){ const formGroup = this.beans.at(fromIdx); this.beans.removeAt(fromIdx); this.beans.insert(toIdx, formGroup); } trackByFn(index: any, item: any) { return index; } 同时需要在ng-for循环部分增加trackBy *ngFor="let item of beans.controls; let i = index; trackBy:trackByFn"