This repository was archived by the owner on May 25, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 215
This repository was archived by the owner on May 25, 2021. It is now read-only.
Augury does not show the state of components when inheriting #1254
Copy link
Copy link
Closed
Labels
Description
- If we explicitly indicate a dependency, then we can completely debug the state of the component
- ServiceA:
@Injectable()
export class ServiceA {
state1 = {
etc: {}
}
}
- AppComponent:
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
})
export class AppComponent {
title = 'app';
constructor(a: ServiceA) {
console.log(a); // ServiceA {state1: {…}}
}
}
- With the usual inheritance, everything is fine
- All services:
@Injectable()
export class ServiceA {
state1 = {
etc: {}
}
}
@Injectable()
export class ServiceB {
state2 = {
etc: {}
}
}
@Injectable()
export class ServiceC {
state3 = {
etc: {}
}
}
@Injectable()
export class ServiceD {
state4 = {
etc: {}
}
}
@Injectable()
export class ServiceE {
state5 = {
etc: {}
}
}
@Injectable()
export class ServiceF {
state6 = {
etc: {}
}
}
- AppComponent
export class SmartComponent {
protected titleSmart = 'app-smart';
protected a: ServiceA;
protected b: ServiceB;
protected c: ServiceC;
protected d: ServiceD;
protected e: ServiceE;
protected f: ServiceF;
constructor(context: Injector) {
this.a = context.get(ServiceA);
this.b = context.get(ServiceB);
this.c = context.get(ServiceC);
this.d = context.get(ServiceD);
this.e = context.get(ServiceE);
this.f = context.get(ServiceF);
}
}
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
})
export class AppComponent extends SmartComponent {
constructor(context: Injector) {
super(context);
console.log(this.a); // ServiceA {state1: {…}}
}
}
- But we do not see the states assigned to the multi parent component
export abstract class CoreInjector {
protected titleSmart = 'app-smart';
protected a: ServiceA;
protected b: ServiceB;
protected c: ServiceC;
protected d: ServiceD;
protected e: ServiceE;
protected f: ServiceF;
constructor(context: Injector) {
this.a = context.get(ServiceA);
this.b = context.get(ServiceB);
this.c = context.get(ServiceC);
this.d = context.get(ServiceD);
this.e = context.get(ServiceE);
this.f = context.get(ServiceF);
}
}
export abstract class SmartComponent extends CoreInjector {
constructor(context: Injector) {
super(context);
}
}
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
})
export class AppComponent extends SmartComponent {
constructor(context: Injector) {
super(context);
console.log(this.a)
}
}
Augury version (required): 1.14.0
Angular version: 4+
OS: Windows 7
Analog: #903
Additional details:
We do not see the dependencies assigned to the parent component