In the view, I have the following script:
<script>
MyObj.initModel(getUrl);
$(document).ready(function () {
ko.applyBindings(MyObj.viewModel, document.getElementById("someId"));
});
</script>
Within the initModel(getUrl) function, there is an ajax call that sets the view model (MyObj.viewModel) using ko.mapping.fromJS(response);
upon success.
This viewModel is then bound to a partial view.
Is it possible to applyBindings only AFTER the ajax call completes?
I attempted to achieve this by modifying my script on the view like so:
`$("#someId").ajaxComplete(function () { ko.applyBindings(MyObj.viewModel, document.getElementById("someId")); });`
However, this approach results in a knockout error regarding multiple bindings of the same element.