我正在使用角度6,但在组件NavBarComponent
中有问题。
问题:Can't resolve all parameters for NavbarComponent: (?, [object Object], [object Object], [object Object], [object Object], [object Object], [object Object]).
这是NavbarComponent
的代码:
export class NavbarComponent implements OnInit {
...
constructor(
private loginService: LoginService,
private languageService: JhiLanguageService,
private languageHelper: JhiLanguageHelper,
private principal: Principal,
private loginModalService: LoginModalService,
private profileService: ProfileService,
private router: Router
) {
}
我猜这是由于LoginService引起的(由于(?)
。)
因此,这里是LoginService
的代码:
@Injectable({ providedIn: 'root' })
export class LoginService {
constructor(
private extraUsrService: ExtraUserService,
private currentExtraUsrService: CurrentExtraUserService,
private languageService: JhiLanguageService,
private principal: Principal,
private trackerService: JhiTrackerService,
private authServerProvider: AuthServerProvider
) {}
我知道,如果删除ExtraUserService
行,则不会出错。但是,如果我坚持下去。
这是ExtraUserService
:
@Injectable({ providedIn: 'root' })
export class ExtraUserService {
private resourceUrl = SERVER_API_URL + 'api/extra-users';
constructor(private http: HttpClient) {}
对于每个服务,由于providedIn: root
,这是一个单例。
我想这是一个循环导入问题,但是我很难找到它。你有什么想法?