加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > 安全 > 正文

我们可以有多个angular2吗?

发布时间:2020-12-17 10:21:24 所属栏目:安全 来源:网络整理
导读:如果有可能有多个路由器插座,我没有任何工作代码但假设我在父母 router-outlet中有登录页面在AppComponent中.登录后,我必须在父 router-outlet中显示MyHomeComponent.现在,假设在MyHomeComponent中我想要一个孩子 router-outlet我希望在用户点击收件箱,发件
如果有可能有多个路由器插座,我没有任何工作代码但假设我在父母< router-outlet>中有登录页面在AppComponent中.登录后,我必须在父< router-outlet>中显示MyHomeComponent.现在,假设在MyHomeComponent中我想要一个孩子< router-outlet>我希望在用户点击收件箱,发件箱和已加星标的链接时显示收件箱邮件,发件箱邮件,已加星标的邮件.请帮我找到这个问题的答案

AppComponent
<路由器出口>< /路由器出口>中

HomeComponent

<a routerLink="/xyz">Inbox</a>
<a routerLink="/abc">Outbox</a>
<router-outlet name='outlet1'></router-outlet>

我的路线路径

{ path: 'login',component: LoginComponent},{ path: '',component: LoginComponent },{ path: 'user',children:[ 
         { path: ':name',children:[ 
               {path:'abc',component: InboxComponent,outlet: 'outlet1' },{path:'xyz',component: OutboxComponent,outlet:'outlet1' } 
    ] }]},{ path: '**',component: PageNotFoundComponent }
您可以拥有一个主要< router-outlet>对于每个路由和其他命名的< router-outlet name =“abc”> s.寻址这些命名出口的路线称为辅助路线.这些路由反映在()中的URL中,如/ crisis-center(aux:chat; open = true)“

也可以看看

> https://angular.io/docs/ts/latest/guide/router.html
> https://angular.io/docs/ts/latest/api/router/index/Routes-type-alias.html
> https://angular.io/docs/ts/latest/api/router/index/Router-class.html
> Angular2 multiple router-outlet in the same template

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读