Knockout debugging

There are chrome extension available but we can use a very basic statement;

console.log("View model: " + ko.toJSON(dataVM));

If we are dealing with array then;

console.log(dataVM()[0]);

If we want to unwrap a view model then (make sure you have created the view model with ko.mapping.fromJS method;

var dataVMUnwrap = ko.mapping.toJS(dataVM);
//convert view model back to js
console.log(JSON.stringify(dataVMUnwrap));
FavoriteLoadingAdd to favorites
Spread the love

Author: Shahzad Khan

Software developer / Architect