首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 ><router-outlet>来自上层组件。Angular 7

<router-outlet>来自上层组件。Angular 7
EN

Stack Overflow用户
提问于 2019-07-16 22:09:52
回答 1查看 30关注 0票数 0

我有<mat-sidenav-container>,我在<mat-sidenav-content>中使用<mat-sidenav><routeroutlet>进行导航

代码语言:javascript
复制
<mat-sidenav-content class="body-sidenav">
    <router-outlet></router-outlet>
</mat-sidenav-content>

这是很好的工作

我的路由器

代码语言:javascript
复制
{
path: 'article-section',
component: AllSectionComponent,
children: [
  {
    path: 'article-section/:id',
    component: ArticleComponent,
  },
]

},

我需要这个模板

因为我不确定,所以我需要AllSectionComponent中的下一个<routeroutlet>

就像这样

代码语言:javascript
复制
  <router-outlet></router-outlet>
<div class="center-folder">
 <div class="row">
  <div *ngFor="let item of articleSection"
   style="width: 100px; margin-right:10px; margin-left: 10px; margin- 
   bottom: 10px;">
    <img class="img-section" src="assets/images/docimgaes/section.png" /> 
    <br>
    <a [routerLink]="['/article-section', 1]">
      <div class="name-section">{{item.name}}</div>
    </a>
  </div>
  </div>
 </div>

但在本例中,我在AllSectionComponent :)的头部打开了object的组件。我有两个html。我需要正常打开与<routeroutlet>,这是在<mat-sidenav-content>。我是否需要命名路由器插座,或者可能有更舒适的决定?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2019-07-17 04:27:11

我只需要它来改造我的路由器。

从这里开始

我的路由器来自这里

代码语言:javascript
复制
    {
      path: 'article-section',
       component: AllSectionComponent,
       children: [
            {
          path: 'article-section/:id',
          component: ArticleComponent,
        },
       ]

到这个

代码语言:javascript
复制
       {
        path: 'article-section',
        component: AllSectionComponent,
      },
      {
        path: 'article-section/:id',
        component: ArticleComponent,
      },
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/57059252

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档