I have this HTML:
<div id="bills" data-role="view" data-model="Bills" data-init="Bills.init" data-layout="default">
<h1 data-bind="text:name">Text</h1>
</div>
and the ViewModel for this is:
var Bills = kendo.observable({
name: "John Doe",
init: function() {
this.doSomething();
},
doSomething: function() {
alert(this.name);
}
});
Both codeparts with "this" are not working. "this.doSomething" produces the error:Object [object Object] has no method 'doSomething'
Why is it not possible to use "this" in such a ViewModel?
<div id="bills" data-role="view" data-model="Bills" data-init="Bills.init" data-layout="default">
<h1 data-bind="text:name">Text</h1>
</div>
and the ViewModel for this is:
var Bills = kendo.observable({
name: "John Doe",
init: function() {
this.doSomething();
},
doSomething: function() {
alert(this.name);
}
});
Both codeparts with "this" are not working. "this.doSomething" produces the error:Object [object Object] has no method 'doSomething'
Why is it not possible to use "this" in such a ViewModel?