LP#1842297 - fix dependency injection issue in subclass component user/sandbergja/lp1842297_openathens_integration
authorJane Sandberg <sandbej@linnbenton.edu>
Wed, 24 Jun 2020 06:29:37 +0000 (23:29 -0700)
committerJane Sandberg <sandbej@linnbenton.edu>
Wed, 24 Jun 2020 06:36:04 +0000 (23:36 -0700)
Injecting services into the subclass of an Angular Component is
treacherous.  Among other issues, the subclass needs to include
a constructor that declares the same dependencies needed by the
parent class, per
https://angular.io/guide/dependency-injection-in-action#inject-into-a-derived-class

Signed-off-by: Jane Sandberg <sandbej@linnbenton.edu>
Open-ILS/src/eg2/src/app/staff/admin/local/openathens-identity.component.ts

index 8ce84c0..6c075b9 100644 (file)
@@ -1,5 +1,14 @@
 import {Component, OnInit} from '@angular/core';
+import {Location} from '@angular/common';
+import {ActivatedRoute} from '@angular/router';
+import {FormatService} from '@eg/core/format.service';
 import {AdminPageComponent} from '@eg/staff/share/admin-page/admin-page.component';
+import {IdlService, IdlObject} from '@eg/core/idl.service';
+import {PcrudService} from '@eg/core/pcrud.service';
+import {OrgService} from '@eg/core/org.service';
+import {PermService} from '@eg/core/perm.service';
+import {AuthService} from '@eg/core/auth.service';
+import {ToastService} from '@eg/share/toast/toast.service';
 
 @Component({
     templateUrl: './openathens-identity.component.html'
@@ -9,6 +18,20 @@ export class OpenAthensIdentityComponent extends AdminPageComponent implements O
     idlClass = 'coai';
     classLabel: string;
 
+    constructor(
+        route: ActivatedRoute,
+        ngLocation: Location,
+        format: FormatService,
+        idl: IdlService,
+        org: OrgService,
+        auth: AuthService,
+        pcrud: PcrudService,
+        perm: PermService,
+        toast: ToastService,
+    ) {
+        super(route, ngLocation, format, idl, org, auth, pcrud, perm, toast);
+    }
+
     ngOnInit() {
         super.ngOnInit();
 
@@ -40,5 +63,9 @@ export class OpenAthensIdentityComponent extends AdminPageComponent implements O
                 }
             }
         );
-    };
-}
\ No newline at end of file
+    }
+
+    deleteSelected = (entries: IdlObject[]) => {
+        super.deleteSelected(entries);
+    }
+}