'Angular 13 Routing: How to loadChildren with canActivate in named outlets

What I want

I want that the preview is loaded in the left outlet, depending on stuff that is defined in the foo.guard. If it is not loaded a fallback module should be loaded into the left outlet. The edit form sould always be loaded into the right outlet.

My question:

Is it possible in angular 13 to lazyload two module in one named outlet, where canLoad/canActivate decides which of the two modules should be loaded?

What I have:

    {
          path: 'customer/:customerId',
          component: VerticalSplitscreenTemplate,
          children: [
            {
              path: '',
              loadChildren: () => import('../modules/preview/preview.module').then(m => m.PreviewModule),
              outlet: 'left',
              canActivateChild: [FooGuard],
            },
            {
              path: '',
              loadChildren: () => import('../modules/fallback/fallback.module').then(m => m.FallbackModule),
              outlet: 'left',
            },
            {
              path: '',
              loadChildren: () => import('../modules/edit-form/edit-form.module').then(m => m.EditFormModule),
              outlet: 'right',
            },
          ],
    },

What actually happens

If the guard returns false, I'm gonna redirected to "/", without the fallback module loaded. If the guard returns true, the form and the preview is loaded as expected. So the fallback setting seems to be totally ignored.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source