Is it possible to inject a service into another service.
I’m getting this error:
AuthService:
import {UserService} from './index';
@Injectable()
export class AuthService {
constructor(
private publicHttp: Http,
private authHttp: AuthHttp,
private userService: UserService
){}
UserService:
@Injectable()
export class UserService {
constructor(){}
}
I’ve added the both Service into the providers array of the app
error Error: Uncaught (in promise): No provider for UserService! (MyApp -> AuthService -> UserService)
at resolvePromise (http://localhost:8100/build/js/angular2-polyfills.js:602:26)
at Anonymous function (http://localhost:8100/build/js/angular2-polyfills.js:638:18)
at ZoneDelegate.prototype.invokeTask (http://localhost:8100/build/js/angular2-polyfills.js:421:18)
at onInvokeTask (http://localhost:8100/build/js/app.bundle.js:27793:25)
at ZoneDelegate.prototype.invokeTask (http://localhost:8100/build/js/angular2-polyfills.js:421:18)
at Zone.prototype.runTask (http://localhost:8100/build/js/angular2-polyfills.js:320:22)
at drainMicroTaskQueue (http://localhost:8100/build/js/angular2-polyfills.js:541:26)