I have two services: LoginService and UserService. I am trying to inject UserService into LoginService and the app won't run.
In the console, I have the error:
Error: Can't resolve all parameters for UserService: ([object Object], ?). at SyntaxError.ZoneAwareError (http://localhost:4200/polyfills.bundle.js:7156:33) at SyntaxError.BaseError [as constructor]
this is my LoginService:
import {UserService} from '../services/user.service';
@Injectable()
export class LoginService {
constructor(public _http: Http,public us:UserService) {
}
and UserService:
@Injectable()
export class UserService {
constructor(private _http: Http , public _ls: LoginService) {
}
angular module:
import {LoginService} from './services/login.service';
import {UserService} from './services/user.service';
@NgModule({
declarations: [
AppComponent,
],
imports: [
BrowserModule,
FormsModule,
HttpModule,
],
exports: [BrowserModule, SlimLoadingBarModule],
providers: [UserService, LoginService, appRoutingProviders],
bootstrap: [AppComponent]
})
export class AppModule { }
UserService
code. – Diatessaron