<router-view> in a dialog

Hi,

I want to use a view having <router-view> in a modal dialog to share the view both in dialog and non-dialog situations. Is there a way to have <router-view> in a dialog?

  <router-view if.bind="!isModal"></router-view>

The above code does not work in non-dialog situations with “Error: There was no router-view found”.

Without the if.bind, once I close the dialog, rendering of HTML does not occur when route changes. Maybe the <router-view> is not canceled when I close the dialog.

So, this also does not work.

 <router-view show.bind="!isModal"></router-view>
1 Like

on a dialog? in a dialog? Correct me if wrong.

1 Like

I thinks it’s okay if there is a way to remove the current router-view and there is. Does anyone know what it is?

1 Like

unfortunately at the moment, it’s not easy to use <router-view/> in a dialog, as all the viewport (router-view) needs to be available at the time the router loads. What you can do, is to have an empty viewport in the component that opens the dialog, and change the route there to get UI reflected on the dialog.

Thanks, Big open. Do you think there is a flag or something like that for skip checking the availability of the viewport when the component on the dialog is loaded?

We’ re using Aurelia 1.

1 Like

Sorry, I’m not aware of any at the moment.

OK, thanks, Big open. We’ll separate files.

1 Like