Why does the "click" callback not invoked the first time after some text is entered into the input like in this fiddle?
var app = {};
app.controller = function(){
this.data = m.prop("");
this.click = function(){
alert("button clicked");
};
};
app.view = function(ctrl){
return m("html", [
m("body", [
m("div", [
m("p", ctrl.data()),
m("input[type=text]", { onchange: m.withAttr("value", ctrl.data) }),
m("button", { onclick: ctrl.click }, "Click")
])
])
]);
};
m.module(document, app);