无法实例化循环依赖

Cannot instantiate cyclic dependency

我正在使用 @ngrx/effects@angular/router。 (Angular 2 版 RC4)

如果我在效果中添加这一行 private router: Router

@Injectable()
export class RouterEffects {
  constructor(
    private updates$: StateUpdates<AppState>,
    private router: Router   // <- this line
  ) {}
}

我会得到这个错误:

EXCEPTION: Cannot instantiate cyclic dependency! (Token Application Initializer -> Token @ngrx/effects Bootstrap Effects -> Router -> ApplicationRef -> ApplicationRef_)

我该如何解决这个问题?谢谢

感谢 gitter 上的 Anthony @qdouble 和 Mike Ryan @MikeRyan52。

https://gitter.im/ngrx/effects?at=57850fc0b79455146fa4236f

Application initializers will be deprecated in the next RC. So it will probably be fixed around then.

A​​nthony 的解决方法在这里: https://gitter.im/ngrx/effects?at=576ff574bb1de91c546fde19