I am trying to update a beaten view model, but every time I push an observable array If I try, then it is an error to me that AuditViewModel is undefined. On this page load, this function always runs with update == incorrect, and it basically populates the visual model. When I call with update == truth later, it fails. Can anyone point me in the right direction? Note that the line You will need to store the visual model elsewhere, that is: Example: function (data, updates) {if (updated == incorrect) {var audit mode = {auditEvents: ko.observableArray (data.requirements)}; Ko.applyBindings (AuditViewModel); } And {auditViewModel.auditEvents.push (data.requirements); }}
var AuditViewModel = {...} only if
updates == incorrect is run. Because AuditViewModel is a local variable, if you call later, when
update == true , auditModel will be undefined.
window.AuditViewModel = {...} .
function (data, updates) {if (update == false) {Window.AuditViewModel = {auditEvents: ko.observableArray (data.requirements)} ; Ko.applyBindings (window.AuditViewModel); } And (window: audit viewmodel.audit avenues.pash (data .requirements);}}
No comments:
Post a Comment