javascript - knockoutjs cannot apply bindings to different ids -
i have several views in project , each applies bindings on own tag this:
(note: periods represents more code removed show problem have, created fiddle bit more complete here: http://jsfiddle.net/eyb8e/)
html
<div id="ui-main"> ... html code bound mainviewmodel here <div/> ... <div id="ui-partial"> ... </div>
javascript
function mainviewmodel() {...}; var mainviewmodel = new mainviewmodel(); ko.applybindings(mainviewmodel, document.getelementbyid("ui-main")); ... function partialviewmodel() {...}; ko.applybindings(partialviewmodel, document.getelementbyid("ui-partial"));
but second applybindings not apply because: "error: cannot apply bindings multiple times same element.". (see in jsfidle: http://jsfiddle.net/eyb8e)
i cannot figure out wrong.
your <div />
should </div>
.
Comments
Post a Comment