org-select: allow applyOrg[Id] to clear the org unit
authorGalen Charlton <gmc@equinoxinitiative.org>
Mon, 2 Mar 2020 17:30:47 +0000 (12:30 -0500)
committerGalen Charlton <gmc@equinoxinitiative.org>
Mon, 2 Mar 2020 17:30:47 +0000 (12:30 -0500)
Signed-off-by: Galen Charlton <gmc@equinoxinitiative.org>
Open-ILS/src/eg2/src/app/share/org-select/org-select.component.ts

index 16f1cbd..d1f1ffc 100644 (file)
@@ -78,9 +78,7 @@ export class OrgSelectComponent implements OnInit {
     // Modify the selected org unit via data binding.
     // This WILL result in an onChange event firing.
     @Input() set applyOrg(org: IdlObject) {
-        if (org) {
-            this.selected = this.formatForDisplay(org);
-        }
+        this.selected = org ? this.formatForDisplay(org) : null;
     }
 
     permLimitOrgs: number[];
@@ -91,9 +89,7 @@ export class OrgSelectComponent implements OnInit {
     // Modify the selected org unit by ID via data binding.
     // This WILL result in an onChange event firing.
     @Input() set applyOrgId(id: number) {
-        if (id) {
-            this.selected = this.formatForDisplay(this.org.get(id));
-        }
+        this.selected = id ? this.formatForDisplay(this.org.get(id)) : null;
     }
 
     // Emitted when the org unit value is changed via the selector.