loop backwards

This commit is contained in:
Drew Ansbacher
2021-12-06 10:10:34 -07:00
committed by Aiden McClelland
parent 698b0d97e5
commit 2bbb4206ea

View File

@@ -237,11 +237,11 @@ export class FormObjectComponent {
private updateEnumList (key: string, current: string[], updated: string[]) { private updateEnumList (key: string, current: string[], updated: string[]) {
this.formGroup.get(key).markAsDirty() this.formGroup.get(key).markAsDirty()
current.forEach((val, index) => { for (let i = current.length - 1; i >= 0; i--) {
if (!updated.includes(val)) { if (!updated.includes(current[i])) {
this.deleteListItem(key, index, false) this.deleteListItem(key, i, false)
}
} }
})
updated.forEach(val => { updated.forEach(val => {
if (!current.includes(val)) { if (!current.includes(val)) {