As per the title, is it necessary to wait for the DOM to load before calling ko.applyBindings
or will Knockout handle this automatically?
I.e - am I safe to just do:
<script>
(function() {
var model = new my.Model();
ko.applyBindings(model);
})();
</script>
No KO doesn't handle this automatically (so the self invoking function would work only at the bottom your page), you have to wait for the DOM loaded with the
ko.applyBindings
call.From the documentation: