0

Hey i have a problem with my Angular 5 App. Ive created a simple app with some component routing. The routing looks like:

{ path: '', component: SetupComponent, pathMatch: 'full' }, // here we can add a landingpage
{ path: 'setup', component: SetupComponent },
{
    path: 'lan/:reference', component: LanComponent, // use special layout here which is defined in LanComponent
    children: [
        { path: '', redirectTo: 'dashboard', pathMatch: 'full' },
        { path: 'dashboard', component: DashboardComponent },
        { path: 'attendees', component: AttendeesComponent },
        { path: 'games', component: GamesComponent },
        { path: 'royal-beefs', component: RoyalBeefsComponent },
    ]
},
{path: '**', component: SetupComponent}

The routing runs like a charm but if i am switching between these child routes the old child is not removed from dom.

enter image description here

If i am switching between the root routes everything works. If i am making the child routes to absolute routes it is also working.

index.html

<body class="m-page--fluid m--skin- m-content--skin-light2 m-header--fixed m-header--fixed-mobile m-aside-left--enabled m-aside-left--skin-dark m-aside-left--offcanvas m-footer--push m-aside--offcanvas-default">
<div class="m-grid m-grid--hor m-grid--root m-page">
  <app-root></app-root> <!-- app.component.ts -->
</div>
</body>

app.component.html

<router-outlet></router-outlet>

lan.component.html

<app-header-nav></app-header-nav>
<!-- begin::Body -->
<div class="m-grid__item m-grid__item--fluid m-grid m-body">
  <div class="m-grid__item m-grid__item--fluid m-wrapper">
    <router-outlet></router-outlet>
  </div>
</div>
<!-- end:: Body -->
<app-footer></app-footer>

in the games.component.html and the others there is only the content. The links will be generated with routerLink like:

[routerLink]="['/lan', params.reference, 'dashboard']"
[routerLink]="['/lan', params.reference, 'attendees']"

As a hint: ive developed this application first without any complex design. Everything works. Now i wanted to integrate Metronic Dashboard Theme and i am getting this problem. If anyone has a solution, please post it :)

UPDATE: Here are some links to the theme:

https://keenthemes.com/metronic/documentation.html

https://keenthemes.com/metronic/preview/?demo=demo12

4

1 回答 1

0

我找到了答案!在我的 html 文件中,我有一个指令 unwraptag。模板需要这个。我删除了它,一切正常。在指令文件中,选择器被标记为 eslint 错误。这是选择器:'[appunwraptag]',

于 2018-05-28T19:18:24.747 回答