aurelia - Get ViewModel of containerless element -
in aurelia when want access view model of dom element aurelia custom element can use au property aurelia attaches, componentelement.au.controller.viewmodel.
when custom element containerless (attribute @containerless on class level) property au not available.
this gist demonstrates this: https://gist.run/?id=928f97f49c01c1db10d8bf4399f5c335
how can access viewmodel of containerless custom component when have reference dom element?
i'm not sure if want, can use view-model.ref. instance:
<less-comp text="item three, containerless" view-model.ref="test"></less-comp> usage:
export class app { attached() { console.log(this.test); } }
Comments
Post a Comment