How can I make a "child" route run automatically? Let's see, I have a file of routes in which there are:
const appRoutes = [
{path: 'home', component: HomeComponent},
{path: 'proyect-list', component: ProyectList,
children:[
{path: 'comp-image-list', component: ImageList, outlet: 'proyectList'},
{path: 'comp-audio-list', component: AudioList, outlet: 'proyectList'},
{path: 'comp-video-list', component: VideoList, outlet: 'proyectList'},
{path: 'comp-web-list', component: WebList, outlet: 'proyectList'}
]
},
{path: 'singInNow', component: LoginComponent},
{path: 'image-detail/:id', component: ImageDetail},
{path: 'audio-detail/:id', component: AudioDetail},
{path: 'audio-add', component: AudioAdd},
{path: 'audio-update/:id', component: AudioUpdate},
{path: 'video-detail/:id', component: VideoDetail},
The file is not completely copied, but for you to get an idea. The fact is that I'm going to "proyect-list" which is one of the main routes of the site. And within this page, I have another "router-outlet" that contains those "child" routes. What I intend is to be presented for example in the router-outlet of this the "comp-image-list" without that I have to give the link that makes that component present. Can it be done? I have been reading the documentation of Routing of Angular 2, and I have not managed to get anything clear about this, or I have not known how to search.
The html of the "project-list" page is this:
<nav class="menuProyect">
<a [routerLink]="[{ outlets: { 'proyectList': ['comp-image-list'] } }]" class="menuProyectLink">Imagen</a>
<a [routerLink]="[{ outlets: { 'proyectList': ['comp-audio-list'] } }]" class="menuProyectLink">Audio</a>
<a [routerLink]="[{ outlets: { 'proyectList': ['comp-video-list'] } }]" class="menuProyectLink">Video</a>
<a [routerLink]="[{ outlets: { 'proyectList': ['comp-web-list'] } }]" class="menuProyectLink">Web</a>
</nav>
<router-outlet name="proyectList"></router-outlet>