# \<router-view\> in a dialog

**URL:** https://discourse.aurelia.io/t/router-view-in-a-dialog/4392
**Category:** Help Requests
**Created:** [September 1, 2021, 3:08am UTC](https://discourse.aurelia.io/t/router-view-in-a-dialog/4392 "2021-09-01T03:08:00Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![HIRANO-Satoshi](https://yyz1.discourse-cdn.com/flex027/user_avatar/discourse.aurelia.io/hirano-satoshi/32/2583_2.png) [@HIRANO-Satoshi](https://discourse.aurelia.io/u/HIRANO-Satoshi)
#### Post date: [September 1, 2021, 3:08am UTC](https://discourse.aurelia.io/t/router-view-in-a-dialog/4392/1 "2021-09-01T03:08:00Z")

</div>

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?

```auto
  <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.

```auto
 <router-view show.bind="!isModal"></router-view>

```

---

<div class="post-metadata">

### Author: ![HIRANO-Satoshi](https://yyz1.discourse-cdn.com/flex027/user_avatar/discourse.aurelia.io/hirano-satoshi/32/2583_2.png) [@HIRANO-Satoshi](https://discourse.aurelia.io/u/HIRANO-Satoshi)
#### Post date: [September 1, 2021, 3:13am UTC](https://discourse.aurelia.io/t/router-view-in-a-dialog/4392/2 "2021-09-01T03:13:29Z")

</div>

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

---

<div class="post-metadata">

### Author: ![HIRANO-Satoshi](https://yyz1.discourse-cdn.com/flex027/user_avatar/discourse.aurelia.io/hirano-satoshi/32/2583_2.png) [@HIRANO-Satoshi](https://discourse.aurelia.io/u/HIRANO-Satoshi)
#### Post date: [September 3, 2021, 12:26am UTC](https://discourse.aurelia.io/t/router-view-in-a-dialog/4392/3 "2021-09-03T00:26:00Z")

</div>

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?

---

<div class="post-metadata">

### Author: ![bigopon](https://yyz1.discourse-cdn.com/flex027/user_avatar/discourse.aurelia.io/bigopon/32/18_2.png) [@bigopon](https://discourse.aurelia.io/u/bigopon)
#### Post date: [September 3, 2021, 12:43am UTC](https://discourse.aurelia.io/t/router-view-in-a-dialog/4392/4 "2021-09-03T00:43:42Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![HIRANO-Satoshi](https://yyz1.discourse-cdn.com/flex027/user_avatar/discourse.aurelia.io/hirano-satoshi/32/2583_2.png) [@HIRANO-Satoshi](https://discourse.aurelia.io/u/HIRANO-Satoshi)
#### Post date: [September 3, 2021, 1:46am UTC](https://discourse.aurelia.io/t/router-view-in-a-dialog/4392/5 "2021-09-03T01:46:59Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![bigopon](https://yyz1.discourse-cdn.com/flex027/user_avatar/discourse.aurelia.io/bigopon/32/18_2.png) [@bigopon](https://discourse.aurelia.io/u/bigopon)
#### Post date: [September 3, 2021, 6:29am UTC](https://discourse.aurelia.io/t/router-view-in-a-dialog/4392/6 "2021-09-03T06:29:50Z")

</div>

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

---

<div class="post-metadata">

### Author: ![HIRANO-Satoshi](https://yyz1.discourse-cdn.com/flex027/user_avatar/discourse.aurelia.io/hirano-satoshi/32/2583_2.png) [@HIRANO-Satoshi](https://discourse.aurelia.io/u/HIRANO-Satoshi)
#### Post date: [September 3, 2021, 6:46am UTC](https://discourse.aurelia.io/t/router-view-in-a-dialog/4392/7 "2021-09-03T06:46:34Z")

</div>

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