EXCEPTION: No provider for UserData! (LoginPage -> UserData)

The situation you describe is in fact referenced in the Angular 2 docs:
https://angular.io/docs/ts/latest/guide/dependency-injection.html#when-the-service-needs-a-service

Please have a look at that section. You do still have to add the service to a providers list somewhere. You could even just do so at the app level if you’re concerned about reuse in different portions of the app. Also somewhat relevant: https://angular.io/docs/ts/latest/guide/hierarchical-dependency-injection.html

1 Like