Часть моего приложения Angular требует одновременного показа двух компонентов, другие части моего приложения требуют показа только одного компонента.У меня нет проблем с маршрутизацией, связанной со «страницами», на которых есть только отдельные компоненты, но у меня есть некоторые проблемы с той, где я использую преимущества вспомогательного маршрутизатора.Код с комментариями приведен ниже.По сути, ошибка получения маршрута не найдена, когда я пытаюсь получить «назад» из представления, использующего вспомогательный маршрутизатор.
//Relevant import to support routing in app.module
import {
Routes,
RouterModule
} from '@angular/router';
//Route array in app.module
const appRoutes: Routes = [{
path: '',
component: HomeComponent
},
{
path: 'admin',
component: BuilderComponent
},
{
path: 'sandbox',
component: SandboxComponent
},
{
path: 'adventure',
component: GuideComponent
},
{
path: 'scanner',
component: ScannerComponent,
outlet: 'secondary'
}
];
//relvant import in imports array in app.module
RouterModule.forRoot(appRoutes)
//Content of my app.component.html file
<
div class = "container" >
<
app - header > < /app-header> <
router - outlet > < /router-outlet> <
router - outlet name = "secondary" > < /router-outlet> < /
div >
//Code in one of my components HTML file that is attached to a button and successfully calls the page with two components
[routerLink] = "[ {
outlets: {
primary: 'adventure',
secondary: 'scanner'
}
}
]
"
//Code I'm trying to use in the 'multi component' view that tries to get back to the 'home' page
[routerLink] = "[ {
outlets: {
primary: '',
secondary: 'sandbox' //This is a blank HTML component so that it doesn't screw up the look of components that don't need the aux router. Super hacky and am welcome to suggestions on how to fix this as well.
}
}
]
"