I'm looking for a way to dynamically provide at runtime view models for any views. Question is if there is hook in the ViewEngine or a view model loader / factory that I can use to do this.

I'm looking into bridging into WebAssembly and allowing view models to be written in other languages and I want to create automatic interop view models on the Javascript side for Aurelia to just work.

1 Answers

bigopon On

This is totally doable, and many have successfully delivered their ultra-dynamic application using Aurelia, as pretty much everything in Aurelia is dynamic.

For example:

Basically it boils down to is to use .compose method from CompositionEngine:

    string // as module path
    | Function // as constructor
    | object // as instance

And make sure the view is resolvable from the view model.