i've got in xml file
<button id="info-button" text="test" tap="{{ oninfotap }}" />
on tapping want call method in context object.
i'm getting compile time warning of:
js: binding: property: 'oninfotap' invalid or not exist. sourceproperty: 'oninfotap'
it's 1-way callback - not property. if remove double curly braces don't callback context object.
help!
are using mvvm structure? if so, can define tap listener button on model page calls function in viewmodel:
in xml:
<button tap="oninfotap" />
in .js
file:
export function oninfotap(args) { // example, pageviewmodel page binding context object pageviewmodel.yourfunction(); }
in viewmodel:
class pageviewmodel extends observable { public yourfunction() { // code here } }
this i'm used do. if don't want remove curly braces, suggest this:
class pageviewmodel extends observable { public yourfunction() { // code here } this.set("oninfotap", yourfunction); }
if these things don't you, please post more code can understand clearer.
Comments
Post a Comment