2016-10-31 3 views
3

Angular2 2.1.2에서 명명 된 라우터 콘센트를 사용할 때 문제가 있습니다.Angular2 라우터 : 콘센트를 찾을 수 없습니다. XOutlet to YComponent

나는 오류 받고 있어요 :

Cannot find the outlet XOutlet to load 'YComponent'

오류 자체가 매우 분명하다,하지만 난 붙어 있으며 주위에 방법을 찾을 수 없습니다.

html로는 다음과 같습니다

<router-outlet name="XOutlet"></router-outlet> 
<!-- Main content --> 
<div class="content-wrapper"> 
    <router-outlet></router-outlet> 
</div> 

경로 파일 : 나는 무엇을 놓치고

<a [routerLink]="['other', {outlets: {'XOutlet': 'list'}}]"><span>Other</span></a> 

{ 
    path: 'other', 
    component: OtherComponent, 
    children: [ 
     { 
      path: 'list', 
      component: YComponent, 
      outlet: 'XOutlet' 
     } 
    ] 
}, 

링크를?

감사

편집 : 올렉 Barinov에 의해 코멘트 바탕으로, 제공되는 HTML은하지 OtherComponent HTML에서 기본 HTML의 일부입니다.

+0

제공된 HTML 템플리트가 'OtherComponent'의 템플리트입니까? –

+0

아니요, HTML은 기본 구성 요소의 일부이며, OtherComponent는 명명되지 않은 콘센트에 렌더링되어야하며 YComponent는 XOutlet에 렌더링되어야합니다. – Martin

+1

자, 이제'[routerLink] = "[ '/', ...'를 사용하려고 시도 할 수 있습니다 –

답변

3

이러한 구현에는 <a [routerLink]="['/', {outlets: {'XOutlet': 'list'}}]"><span>Other</span></a>을 사용하십시오.

관련 문제