# Dynamic \<compose\>

**URL:** <https://discourse.aurelia.io/t/dynamic-compose/1831>\
**Category:** Uncategorized\
**Created:** [October 30, 2018, 1:21pm UTC](https://discourse.aurelia.io/t/dynamic-compose/1831 "2018-10-30T13:21:00Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tim-Erwin](https://yyz1.discourse-cdn.com/flex027/user_avatar/discourse.aurelia.io/tim-erwin/32/1133_2.png) [@Tim-Erwin](https://discourse.aurelia.io/u/Tim-Erwin)\
**Post date:** [October 30, 2018, 1:21pm UTC](https://discourse.aurelia.io/t/dynamic-compose/1831/1 "2018-10-30T13:21:00Z")

</div>

I created a simple (simple as in Hello World) view/view model and want to insert that into my app using compose (because it’s data-driven). It works if I use a static string, but not using a variable like so:

```
<compose view-model="${ viewName }"></compose>

```

That gives me the following error:

![01](https://canada1.discourse-cdn.com/flex027/uploads/aurelia/original/2X/7/736ffd1d7bfd7d572d96a9d7e0329e077acf8328.png)

How can I dynamically specify the view-model? According to [ilikekillnerds](https://ilikekillnerds.com/2015/10/aurelia-dynamic-composition/) this should have worked at least in 2016.

---

<div class="post-metadata">

**Author:** ![Tim-Erwin](https://yyz1.discourse-cdn.com/flex027/user_avatar/discourse.aurelia.io/tim-erwin/32/1133_2.png) [@Tim-Erwin](https://discourse.aurelia.io/u/Tim-Erwin)\
**Post date:** [October 30, 2018, 1:36pm UTC](https://discourse.aurelia.io/t/dynamic-compose/1831/2 "2018-10-30T13:36:17Z")

</div>

As always, you can search for hours but only find the answer after you post the question. I added the view to webpack by putting

```
import { PLATFORM } from 'aurelia-pal';
PLATFORM.moduleName('./myView');

```

somewhere in my code. `<require from='./myView'>` didn’t help.

---

<div class="post-metadata">

**Author:** ![huochunpeng](https://avatars.discourse-cdn.com/v4/letter/h/49beb7/32.png) [@huochunpeng](https://discourse.aurelia.io/u/huochunpeng)\
**Post date:** [October 30, 2018, 4:10pm UTC](https://discourse.aurelia.io/t/dynamic-compose/1831/3 "2018-10-30T16:10:49Z")

</div>

You are trying to match double quote with single quote.

Set up your editor to run htmlhint to avoid html syntax error.

---

<div class="post-metadata">

**Author:** ![Tim-Erwin](https://yyz1.discourse-cdn.com/flex027/user_avatar/discourse.aurelia.io/tim-erwin/32/1133_2.png) [@Tim-Erwin](https://discourse.aurelia.io/u/Tim-Erwin)\
**Post date:** [October 30, 2018, 4:23pm UTC](https://discourse.aurelia.io/t/dynamic-compose/1831/4 "2018-10-30T16:23:12Z")

</div>

That’s more a problem of me typing the wrong thing here, sorry. The problem has already been found and fixed (see previous answer). Thanks for your answer anyway.
