I currently use Knockout, but am trying out Kendo to see how the two compare. With Knockout there are a couple of potential view model creation patterns, one is to use a literal:
var viewModel = {
firstname: ko.observable("Bob")
};
ko.applyBindings(viewModel );
and the other is to use a function:
var viewModel = function() {
this.firstname= ko.observable("Bob");
};
My preference has always been to use a function because it essentially gives you a 'factory' allowing you to create multiple instances of the same view model.With KendoUI, all the examples I have seen use a literal syntax:
var viewModel = kendo.observable({
firstname: "Bob"
});
kendo.bind(document.body, viewModel);
My question is, with Kendo is it possible to emulate the Knockout style of view model creation via functions? This would allow me to create multiple instances of the same view model, add 'private' functions, etc ...
var viewModel = {
firstname: ko.observable("Bob")
};
ko.applyBindings(viewModel );
and the other is to use a function:
var viewModel = function() {
this.firstname= ko.observable("Bob");
};
My preference has always been to use a function because it essentially gives you a 'factory' allowing you to create multiple instances of the same view model.With KendoUI, all the examples I have seen use a literal syntax:
var viewModel = kendo.observable({
firstname: "Bob"
});
kendo.bind(document.body, viewModel);
My question is, with Kendo is it possible to emulate the Knockout style of view model creation via functions? This would allow me to create multiple instances of the same view model, add 'private' functions, etc ...