Tutorial by Examples

Many bugs in knockout data binds are caused by undefined properties in a viewmodel. Knockout has two handy methods to retrieve the binding context of an HTML element: // Returns the binding context to which an HTMLElement is bound ko.contextFor(element); // Returns the viewmodel to which ...
Sometimes it is useful to print a current binding directly from markup. A neat trick which allows that is to use an additional DOM element with a non-existing binding (KO < 3.0), custom binding or a binding that is not relevant such as uniqueName. Consider this example: <tbody data-bind=&quo...

Page 1 of 1