라우트 된 구성 요소에서 이벤트를 받고 부모 구성 요소로부터 데이터를 전달하고 싶습니다.Angular2 라우터 - 아웃렛 구성 요소 이벤트 발생 (A2> = v1.2.0)
콘텐츠 앱 템플릿 :
<router-outlet [data]='data' (selected)="selected($event)"></router-outlet> //this is not working
A '콘텐츠 응용 프로그램'라우팅 된 구성 요소에서 이벤트를 받아야 구성 요소 (예 : '콘텐츠 앱 목록')
<content-app> // this is where the events should arrive
<content-app-header></content-app-header>
<router-outlet></router-outlet>
<content-app-list></content-app-list> //this is a routed component, that emits events and should bind data
</content-app>
내가 할 수있는 데이터를 처리하는 서비스를 구현하지만 프레임 워크 개념을 선호합니다.
부모 인젝션이 효과적입니다. 라우팅 된 자식에게 부모 호출 기능을 제공 할 수있는 권한을 부여하기 위해 부모에서 등록 기능을 구현했습니다. – marcel