I have problem with pass data to router outlet. Usually I do something like below:
<router-outlet (activate)="setConfig($event)"></router-outlet>
and
setConfig(component: { [key: string]: any }) {
component.data = this.data;
}
and it works perfect.
But problem is when I have multiply router-outlet with empty path and name. So in routing.module I have:
{
path: 'test',
component: TestComponent,
children: [
{
path: '',
loadChildren: () => loadRemoteModule({
remoteName: 'test1',
remoteEntry: `/c/test1/remoteEntry.js`,
exposedModule: 'Test1Module',
}).then(m => m.Test1Module)
},
{
path: '',
outlet: 'test2',
loadChildren: () => loadRemoteModule({
remoteName: 'test2',
remoteEntry: `/c/test2/remoteEntry.js`,
exposedModule: 'Test2Module',
}).then(m => m.Test2Module)
}
]
},
and in component:
<router-outlet (activate)="setConfig($event)"></router-outlet>
<router-outlet (activate)="setConfig($event)" name="test2"></router-outlet>
In this case I can't set component.data = this.data, because when I console.log component inside setConfig it isn't my component from child route as I expected, it is "ɵEmptyOutletComponent", and I don't know how to pass data to this component in this case.
Test1 and Test2 are microfrontends, there are independents projects and there arent't part of project where Test Component is.