|
|
|
@ -209,16 +209,18 @@ export class EntityListComponent implements ControlValueAccessor, OnInit, OnChan |
|
|
|
this.searchText = ''; |
|
|
|
if (value != null && value.length > 0) { |
|
|
|
this.modelValue = [...value]; |
|
|
|
this.entityService.getEntities(this.entityType, value).subscribe( |
|
|
|
(entities) => { |
|
|
|
this.entities = entities; |
|
|
|
this.entityService.getEntities(this.entityType, value) |
|
|
|
.subscribe(resolvedEntities => { |
|
|
|
this.entities = resolvedEntities; |
|
|
|
this.entityListFormGroup.get('entities').setValue(this.entities); |
|
|
|
if (this.syncIdsWithDB && this.modelValue.length !== entities.length) { |
|
|
|
this.modelValue = entities.map(entity => entity.id.id); |
|
|
|
if (this.syncIdsWithDB && this.modelValue.length !== this.entities.length) { |
|
|
|
this.modelValue = this.entities.map(entity => entity.id.id); |
|
|
|
if (!this.modelValue.length) { |
|
|
|
this.modelValue = null; |
|
|
|
} |
|
|
|
this.propagateChange(this.modelValue); |
|
|
|
} |
|
|
|
} |
|
|
|
); |
|
|
|
}); |
|
|
|
} else { |
|
|
|
this.entities = []; |
|
|
|
this.entityListFormGroup.get('entities').setValue(this.entities); |
|
|
|
|