Dynamic <compose>


#1

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:

How can I dynamically specify the view-model? According to ilikekillnerds this should have worked at least in 2016.


#2

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.


#3

You are trying to match double quote with single quote.

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


#4

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.