왜이 서브 루팅이 작동하지 않습니까? 나는이 질문을 확인했다 A similar issue. 보다 구체적인 경로를 먼저 이동함으로써 주어진 해결책을 구현했지만 문제가 해결되지 않았습니다. 내가 Whatsup에있는 링크를 클릭하면왜 내 서브 루트가 angular2에서 작동하지 않습니까?
App.component.ts는
import {Whatsup} from "./whatsup.component";
...
template:`
<li id="whatsup" (click)="loadField('whatsup')" ><a [routerLink]="['/whatsup/...']"> Whatsup?</a></li>
<router-outlet></router-outlet>
`
...
@Routes([
{path: '/whatsup/...', component: Whatsup}
])
Whatsup.component.ts는
import {Calendar} from "./Calendar.component";
...
template:`
<li class="list-group-item"><a [routerLink]="['/today']">{{today | date:'EEEEE'}}</a></li>
<router-outlet></router-outlet>
`
...
@Routes([
{path:"/today", component: Calendar}
])
Whatsup 성공적으로로드,하지만 난이 오류가 발생합니다 :
미처리 Promise 거부 : 경로를 찾을 수 없습니다. 현재 세그먼트 : '오늘' 사용 가능한 경로 : [ '/ whatsup/...', '/ our-recommendations', '/ leave-review', '/ deals-in-town']. ; 구역 : 각; 작업 : Promise.then; 값 : Object {message : "모든 경로와 일치 할 수 없습니다. 현재 ...", 스택 : "BaseException @http://localhost:3000 ..."}
'...'자리를 비 웠음에도 문제가 해결되지 않았으므로 지금은 사용 중지 된 라우터로 되돌아갑니다. – Dan
'[routerLink] = "[ '/ whatsup/...']'에'/ ... '표시가있는 것을 보았습니다. 이것은 @ angle/router-deprecated에서도 아닙니다. 또한 http://stackoverflow.com/questions/37605119/angular2-router-angular-router-how-to-set-default-route/37605802#37605802하지만 '@ angular/router-deprecated'로 머무르는 것이 좋습니다. –
새 라우터를 작동시킬 수 없어서 @ angular/router-deprecated로 되돌 렸습니다.이 작업을 위해이 링크가 도움이된다는 것을 알았습니다. http://stackoverflow.com/questions/ 37000243/angular2-router-deprecated-dependencies-not-loading-loaded. – Dan