Knockoutjs Data Update Writes Internal Function To Ui
I'm having this odd issue when I update my viewmodel...basically with every update, there appears to be a random chance that each observable will contain this data: function observ
Solution 1:
This has something to do with the "()" appended onto the data object in the template. What I've found is that during the first render (page load) writing the template like this:
<divdata-bind="template: {name: 'issueTemplate', data: incidents}"></div><scriptid="dashboardIssueTemplate"type="text/html"><divdata-bind="text: title"></div></script>
works just fine. However, once you run the update on the observableArray my "title" object becomes that function. If I write the template using this style:
<divdata-bind="text: title()"></div>
It seems to work on every update.
I am not certain why this is the solution. From the looks of it, the data object being passed to the Knockout binder is the exact same on both page load and update. I'll post this as an answer, but I'm not marking it as an answer until I understand why this is happening.
Post a Comment for "Knockoutjs Data Update Writes Internal Function To Ui"