小编Opt*_*zal的帖子

使用angular2中的app.component.html中的*ngIf更改路由器插座

我正在使用角度2.0决赛.我正在尝试更改主app.component.html中路由器插座的位置.模板正在更新精细显示,除了,我第一次使用router.navigate组件将不会显示在新的路由器插座中,并且没有错误.第二次和每次使用router.navigate后它都能正常工作.

app.component.html的示例模板

   <div *ngIf="authenticated() == false">
      <h1>not logged in</h1>
      <router-outlet>
      </router-outlet>
    </div>
    <div *ngIf="authenticated()">
      <h1>logged in</h1>
      <router-outlet>
      </router-outlet>
    </div>
Run Code Online (Sandbox Code Playgroud)

angular2-template angular2-routing angular

13
推荐指数
2
解决办法
9513
查看次数