I'm trying to figure out the difference between two ways of service injection in Angular 5:
1
constructor(private _anyService: AnyService) { }
2
private _anyService: AnyService;
constructor(private _injector: Injector) {
this._anyService = this._injector.get(AnyService);
}
Do we finally get the same result, will this._anyService behave the same in both cases?
P.S.: The context is not important for this example, the question is only about the service instances, doesn't matter, which variables/class properties hold this instance.