Angular 2: Property injection instead of constructor injection
You can do this:
myService: MyService = this.injector.get(MyService);constructor(private injector:Injector) {}
The Injector is in @angular/core
No you can't do it. Injectable service will e injected when the constructor is called.
The goal is to simplify the constructor signature.
There is no need to simplify constructor signature. For readability you can write them in multiple lines.
so all child component to not need to specify appConfig in their constructor
In your case only classes that inherit your class will access that. But if you mean child component those ones which are used in your component, they can't access variables in parent component. You need to pass them.
UPDATED
Your this.config
is always visible in inherited components. There is no need to again inject appConfig
in the SportTemplates
component.