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

Popular posts from this blog

Is there a better way to structure post methods in Class Based Views -

performance - Why is XCHG reg, reg a 3 micro-op instruction on modern Intel architectures? -

jquery - Responsive Navbar with Sub Navbar -