注入服务后无法解析NavbarComponent的所有参数

时间:2018-07-31 14:23:12

标签: angular typescript jhipster angular6 angular-services

我正在使用角度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,这是一个单例。 我想这是一个循环导入问题,但是我很难找到它。你有什么想法?

0 个答案:

没有答案