Hello, I'm struggling with injecting a service into a service

@iignatov: it is definitely possible. That thread you linked is really confusing because OP didn’t want to put both services in the app’s providers array. This OP claims that they did do that, and if that’s really true it should work. Here’s some snippets from a working application of mine:

@Component({
  providers: [HTTP_PROVIDERS, Sink, Identity, AuthedHttp],
  template: require<string>('./app.html')
})
@Injectable()
export class MyApp {
}

@Injectable()
@Component({
  template: require<string>('./login.html')
})
export class LoginPage {
  constructor(private _me:Identity) {
  }
}

@Injectable()
export class Identity {
   constructor(private _sink:Sink) {
  }
}

export class Sink {
  constructor() {
  }
}

The _me instance variable in the login page has its sink properly provided by DI. There’s even an additional level, as AuthedHttp injects Identity in order to use it to wrap http methods with authentication tokens:

Injectable()
export class AuthedHttp {
  constructor(private _http: Http, private _identity: Identity) {
  }
}
1 Like