Browse Source

UI: Fixed process error in resource library component

pull/8562/head
Vladyslav_Prykhodko 3 years ago
parent
commit
a48416e442
  1. 12
      ui-ngx/src/app/shared/components/resource/resource-autocomplete.component.ts

12
ui-ngx/src/app/shared/components/resource/resource-autocomplete.component.ts

@ -130,9 +130,15 @@ export class ResourceAutocompleteComponent implements ControlValueAccessor, OnIn
if (isDefinedAndNotNull(value)) { if (isDefinedAndNotNull(value)) {
this.searchText = ''; this.searchText = '';
if (isObject(value) && typeof value !== 'string' && (value as TbResourceId).id) { if (isObject(value) && typeof value !== 'string' && (value as TbResourceId).id) {
this.resourceService.getResourceInfo(value.id, {ignoreLoading: true, ignoreErrors: true}).subscribe(resource => { this.resourceService.getResourceInfo(value.id, {ignoreLoading: true, ignoreErrors: true}).subscribe({
this.modelValue = resource.id; next: resource => {
this.resourceFormGroup.get('resource').patchValue(resource, {emitEvent: false}); this.modelValue = resource.id;
this.resourceFormGroup.get('resource').patchValue(resource, {emitEvent: false});
},
error: () => {
this.modelValue = '';
this.resourceFormGroup.get('resource').patchValue('');
}
}); });
} else { } else {
this.modelValue = value; this.modelValue = value;

Loading…
Cancel
Save