LP1830432: Use a stub callback with registerOnTouched
authorJane Sandberg <sandbej@linnbenton.edu>
Mon, 8 Jul 2019 14:03:50 +0000 (07:03 -0700)
committerBill Erickson <berickxx@gmail.com>
Wed, 10 Jul 2019 17:55:47 +0000 (13:55 -0400)
Signed-off-by: Jane Sandberg <sandbej@linnbenton.edu>
Signed-off-by: Bill Erickson <berickxx@gmail.com>

Open-ILS/src/eg2/src/app/share/org-family-select/org-family-select.component.html
Open-ILS/src/eg2/src/app/share/org-family-select/org-family-select.component.ts

index 3134751..b9bdf02 100644 (file)
   <div class="form-check" *ngIf="!hideAncestorSelector">
     <input type="checkbox"
       formControlName="includeAncestors"
-      (blur)="registerOnTouched()"
+      (blur)="propagateTouch()"
       class="form-check-input" id="{{domId}}-include-ancestors">
     <label class="form-check-label" for="{{domId}}-include-ancestors" i18n>+ Ancestors</label>
   </div>
   <div class="form-check" *ngIf="!hideDescendantSelector">
     <input type="checkbox"
       formControlName="includeDescendants"
-      (blur)="registerOnTouched()"
+      (blur)="propagateTouch()"
       class="form-check-input" id="{{domId}}-include-descendants">
     <label class="form-check-label" for="{{domId}}-include-descendants" i18n>+ Descendants</label>
   </div>
index 3e1e6e8..bf10232 100644 (file)
@@ -61,6 +61,7 @@ export class OrgFamilySelectComponent implements ControlValueAccessor, OnInit {
     familySelectors: FormGroup;
 
     propagateChange = (_: OrgFamily) => {};
+    propagateTouch = () => {};
 
     constructor(
         private auth: AuthService,
@@ -138,7 +139,9 @@ export class OrgFamilySelectComponent implements ControlValueAccessor, OnInit {
         this.propagateChange = fn;
     }
 
-    registerOnTouched() {}
+    registerOnTouched(fn) {
+        this.propagateTouch = fn;
+    }
 
     disableAncestorSelector(): boolean {
         return this.options.primaryOrgId === this.org.root().id();