my view model is very simple
var viewModel = {
self: this,
description: ko.observable('some description'),
dateOfLost: ko.observable('01/01/2012'),
plaintiffFirmName: ko.observable('Johnson, Brand & Tall'),
claimantName: ko.observable(),
claimNum: ko.observable(),
getFormData:function () {
alert('event');
GetClaimData();
}
};
but when I'm trying to access model from html page
<pre data-bind="text: ko.toJS($data)"></pre>
I'm getting error - Access denied. Can any one tell me why? please note that all the fields above that line binded properly
Many thanks
Remove self:this
from viewModel
var viewModel = {
description: ko.observable('some description'),
dateOfLost: ko.observable('01/01/2012'),
in current context this
is window
object. The same error you will get by calling ko.toJS(window)
JSFiddle DEMO
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With