Migrating Au1's #enhance to Au2's #enhance

Maybe you can follow this tutorial: https://docs.aurelia.io/tutorials/synthetic-view
it shows how to manually specify scope with context, override context and parent scope.
But it requires converting your element to template - it will be removed from DOM and new enhanced version will be added to DOM.
The above technique will not work if you want to keep DOM element references and javascript events working, that were added to DOM element before enhancing .

I have asked the same questions here: How to enhance single HTML element without wrapping it with <template> tag or other container?

1 Like