Recipies
의 목록이있는 Recipe Book
을 갖도록 앱을 설정했습니다. 그러면 레서피를 클릭하면 중첩 된 경로에 Recipe Details
이 표시됩니다. 또한이 버튼을 클릭하면 Recipes Details
내부의 중첩 된 경로에있는 재료가로드됩니다.각도 2 던지기 오류 : 아울렛이 활성화되지 않았습니다.
Recipe
으로 이동하려고 시도한 경우를 제외하고는 지금까지 라우팅이 작동하는 것처럼 보입니다. Ingredients
트레이 (경로)가 활성화되면 다음은 레시피를 변경하고 난 다음 시도하고 이동하면 나는 다음과 같은 오류 얻을 (재료를 열지 않고)는 Ingredients
노선을 축소
Uncaught (in promise): Error: Outlet is not activated
Error: Outlet is not activated
그것은 내가 같은 모습을 라우터에 Ingredients
이 활성화되어 있어야합니다. 그렇지 않으면 중첩 된 경로를 이해할 수 없습니다. 그게 전부지만, 그것을 해결하는 방법이나 내가 잘못했을 때 확실하지.
단일 조리법 책 page.component.html
<app-tray class="recipe-list">
<app-recipe-list [recipe]="recipe"></app-recipe-list>
</app-tray>
<router-outlet></router-outlet>
조리법 detail.component.html
<app-tray class="recipe">
The routing has worked and loaded recipe.
</app-tray>
<router-outlet></router-outlet>
성분-list.component.html
<app-tray class="ingredients-list">
Recipe Ingredients have loaded.
</app-tray>
app.routes.ts은은 (업데이트)
export const routerConfig : Route[] = [
{
path: 'recipe-books',
children: [
{
path: ':id', component: SingleRecipeBookPageComponent,
children: [
{
path: 'recipes',
children: [
{ path: ':id', component: RecipeDetailComponent,
children: [
{ path: '', component: IngredientsListComponent },
{ path: 'ingredients', component: IngredientsListComponent }
]
},
{ path: 'new', component: IngredientsListComponent },
{ path: '', component: RecipeDetailComponent }
]
},
{ path: '', redirectTo: 'recipes', pathMatch: 'full' }
]
},
{ path: '', component: RecipeBooksPageComponent }
]
},
{ path: 'ingredients', component: IngredientsComponent },
{ path: '', redirectTo: 'recipe-books', pathMatch: 'full' },
{ path: '**', redirectTo: 'recipe-books', pathMatch: 'full' }
];
이러한 경로는 무엇입니까? –
2 개의 빈 경로 하위 경로에'pathMatch : 'full'을 추가하지 않았습니다. 플 런커에서 재생산 할 수 있습니까? –
컴포넌트가 있어도'pathMatch : full'을 추가해야합니까? – Daimz