0

我的 AuthGuard 类中有这个构造函数:

@Injectable()
export class AuthGuard implements CanActivate {
    constructor(
        private ribbonService: RibbonService,
        private checkSessionService: CheckSessionService,
        private router: Router) { }

    // etc
}

当我构建它时很好,但是通过浏览器访问时出现以下错误:

reflective_provider.js:233 Uncaught Cannot resolve all parameters for 'AuthGuard'(undefined, CheckSessionService, Router). 
Make sure that all the parameters are decorated with Inject or have valid type annotations and that 'AuthGuard' is decorated with Injectable.

我不明白为什么它只发生在第一个服务而不是第二个。我认为这是继承的问题,因为第一个服务正在扩展 BaseService 但后来我也让第二个服务扩展了 BaseService 并且它可以工作,有问题的只是第一个......

注意我也尝试为每个参数添加 @Inject 装饰器,但结果是一样的。

先谢谢了!!

4

1 回答 1

0

RibbonService(或其依赖项之一)未正确导入或提供。

于 2016-06-28T10:29:10.710 回答