小编Kar*_*l L的帖子

Angular 2使用子路由进行身份验证

我有一个角度2应用程序,我需要在每个页面上进行身份验证.所以我已经实现了一个自定义的RouterOutlet来确认我在每次更改页面时都已登录.

@Directive({
   selector: 'auth-outlet'
})
export class AuthOutlet extends RouterOutlet {
   publicRoutes: any;
   private parentRouter: Router;
   private authService: AuthService;
   constructor(_elementRef: ElementRef, 
               _loader: DynamicComponentLoader, 
               _parentRouter: Router,
               @Attribute('name') nameAttr: string, 
               _authService: AuthService) {

      super(_elementRef, _loader, _parentRouter, nameAttr);
      this.parentRouter = _parentRouter;
      this.authService = _authService;
      this.publicRoutes = {
          'Login': true
      };
  }

  activate(oldInstruction: ComponentInstruction) {
      var url = this.parentRouter.lastNavigationAttempt;
      console.log('attemping to nav');
      if (!this.publicRoutes[url] && !this.authService.loggedIn){
          var newInstruction = new ComponentInstruction('Login', [], new RouteData(), Login, false, 1);
          return super.activate(newInstruction);
      } else {
          return super.activate(oldInstruction); …
Run Code Online (Sandbox Code Playgroud)

angular2-routing angular

8
推荐指数
1
解决办法
4029
查看次数

在 Docker Jupyter notebook 的 GUI 中显示卷文件

我使用 Docker 运行 Jupyter Notebook,并尝试将本地目录挂载到预期的 Docker 卷上。但是我无法在 Jupyter 笔记本中看到我的文件。Docker 命令是

sudo nvidia-docker create -v ~/tf/src -it -p 8888:8888 
   -e PASSWORD=password 
   --name container_name gcr.io/tensorflow/tensorflow:latest-gpu
Run Code Online (Sandbox Code Playgroud)

Jupyter Notebook 的 GUI 看起来像

Jupyter 笔记本

但未~/tf/src显示在 Jupyter GUI 中。

文件需要什么才能显示在 Jupyter 中?我是否为此错误地初始化了容器?

docker jupyter-notebook

5
推荐指数
1
解决办法
6913
查看次数