Router: Optional Viewports not working as expected


I am trying to implement routing with optional viewports, but am running into trouble: Viewports for which no instruction is present in the initial route are never rendered (by subsequent routes).

What I really want is optional viewports “as advertised”. I have prepared a gist here.

I suspect I am missing the blindingly obvious …

Thanks for your support,


If you change your first route to this…

{ route: ['','a'],  viewPorts: { viewporta: {moduleId: './a'},  viewportb: {moduleId: null }}},

… it works as expected. I assume something in the router setup means that the default route needs to have all the viewports defined?


Defining all viewports in the default route is exactly what I am trying to avoid: I am dynamically composing elements which have viewports, so at the time of configuring the router I do not know which viewports I will have.

I was hoping that I could create a dynamic route that uses a dynamically generated named viewport. If I need to know all viewports in advance, that approach will not work …


I found dynamic routes/viewports needed to be defined before starting up the application. I think all routes need the same viewports to be assigned (otherwise TypeScript errors occur invoking unassigned) though some could be defined to empty or null values. They can, of course, be re-assigned dynamically at any time to values that already exist (but not new values that are created to brand new data at run time)