John John - 10 months ago 117
Javascript Question

Aurelia - Reference custom element view model inside slot

If I have a custom element like this:

export class mycomponent {
constructor() { = 'John Doe';

My component

And use this component inside another view (I registered the custom element globally):


It is possible to access the view model of
in this scope? Like printing out its property
for example?

Answer Source

As far as I know, it cannot be achieved using slots.

However, Aurelia has a feature called replaceable parts: [Blog post]. This might be a better fit for your requirements.