javascript - Convert certain data bind values into Json using Knockoutjs -
i new knockoutjs, have next viewmodel:
var testing = function(){ this.username = ko.observable(""); this.password = ko.observable(""); this.email = ko.observable(""); }
i need convert info bind values(username , password) json. values getting converted json when utilize data = ko.tojson(this);
so how can filter info bind values , convert json ?
you either serialize want or take ryan neidermeyer's approach , remove unwanted properties -
var items = ko.tojs(this); var mappeditems = ko.utils.arraymap(items, function(item) { delete item.email; homecoming item; });
javascript json knockout.js
No comments:
Post a Comment