ComponentInstruction 和 CanActivate 在 angular 2 rc1 中不可用

ComponentInstruction and CanActivate are not available in angular 2 rc1

我正在使用带有 angular 2 rc.1

的打字稿编写一个 angular2 应用程序

我猜 angular 2 个文件还没有更新。

https://angular.io/docs/ts/latest/api/router/ComponentInstruction-interface.html

https://angular.io/docs/ts/latest/api/router/CanActivate-decorator.html

ComponentInstruction 接口和 CanActivate 装饰器在 angular2-rc.1 中不再可用。那里有什么?

我有以下 class 需要升级到最新的 angular 版本。

class RequireUserAnnotation extends CanActivate {
  constructor() {
    super(this.canProceed.bind(this));
  }

  canProceed(prev: ComponentInstruction,
         next: ComponentInstruction) {
    return !!Meteor.user();
  }
}

新的@angular/router 包现在有 CanDeactivate 和 OnActivate。这让我有点困惑。

我猜 https://angular.io/docs/js/latest/api/router/CanDeactivate-interface.html 也没有更新,因为它说:The routerCanDeactivate hook is called with two ComponentInstructions as parameters,并且不再定义 ComponentInstruction。

我不想使用 angular/@router-deprecated 包。我想解决这个问题!请! :)

如能提供有关此问题的任何信息,我们将不胜感激。

这还没有实现。参见 https://github.com/angular/angular/issues/4015#issuecomment-217678683

Did anyone attend Brandon's workshop (https://www.ng-conf.org/#/sessions/bdogg64FD) yesterday? It was scheduled to discuss "resolving data before loading routes", and appears to have been using the new-new router (with CanActivate moved/relocated).

I attended :smile: I didn't cover resolving data before loading routes because that mechanism doesn't exist in the new router yet.

也许还有https://github.com/angular/angular/issues/7784#issuecomment-217912079