LP1840050 Org select sanity checks on selected value
authorBill Erickson <berickxx@gmail.com>
Fri, 16 Aug 2019 20:56:42 +0000 (16:56 -0400)
committerGalen Charlton <gmc@equinoxinitiative.org>
Fri, 6 Sep 2019 16:58:34 +0000 (12:58 -0400)
Avoid use of org-select 'selected' value when it's not defined/null.

Signed-off-by: Bill Erickson <berickxx@gmail.com>
Signed-off-by: Galen Charlton <gmc@equinoxinitiative.org>
Open-ILS/src/eg2/src/app/share/org-select/org-select.component.html
Open-ILS/src/eg2/src/app/share/org-select/org-select.component.ts

index d49217c..32bc94e 100644 (file)
@@ -4,7 +4,7 @@
 {{r.label}}
 </ng-template>
 
-<ng-container *ngIf="readOnly">
+<ng-container *ngIf="readOnly && selected">
   <span>{{selected.label}}</span>
 </ng-container>
 
index dee3248..dc14deb 100644 (file)
@@ -182,7 +182,7 @@ export class OrgSelectComponent implements OnInit {
     }
 
     // Remove the tree-padding spaces when matching.
-    formatter = (result: OrgDisplay) => result.label.trim();
+    formatter = (result: OrgDisplay) => result ? result.label.trim() : '';
 
     // reset the state of the component
     reset() {