Skip to content Skip to sidebar Skip to footer

Troubles With Knockoutjs Binding

I'm new to knockoutjs, and my bindings are not working. Nothing is displayed. HTML:

Solution 1:

Because you have included the a.js in the header it gets executed before the DOM is loaded.

But the ko.applyBindings needs to be called after the DOM was loaded (see documentation: Activating Knockout section).

So you have two options:

Move the <script type='text/javascript' src='a.js'></script> inside the body after your table.

Or wait for the DOM loaded event (for example with using jQuery):

$(function(){
    ko.applyBindings(newTimelinesViewModel());
});

Post a Comment for "Troubles With Knockoutjs Binding"