I am working on a multi-tenant meeting scheduling application using Asp.net MVC and knockoutjs . I need help solving a javascript code template. I have the following script:
I get a complex ViewModel (name: TenantModel) from the server, and in javascript I use a plugin to display knockouts to create a knockout model.
Let's see what I have in my TenantModel:
TenantModel contains various complex types, such as:
- <EmployeeModel> List
- <CustomerModel> List
- <ServicesModel> List
- Profilemodel
- and many others.
These complex types may also contain complex types, such as:
- EmployeeModel , .
- Model ContactModel
:
Module Pattern javascript-. javascript :
var profile = (function () {
var _viewmodel;
var initialize = function () {
};
var bind = function (node) {
ko.applyBindings(_viewmodel, node);
};
return {
initialize: initialize,
bind: bind
};
})();
var employee = (function () {
var _viewmodel;
var initialize = function () {
};
var bind = function (node) {
ko.applyBindings(_viewmodel, node);
};
return {
initialize: initialize,
bind: bind
};
})();
var tenant = (function () {
var _viewmodel;
var initialize = function (jsonTenantModel) {
_viewmodel = ko.mapping.fromJSON(jsonTenantModel, {
'Profile': {
create: function (option) {
}
},
'Employees': {
create: function (option) {
}
}
})
};
var bind = function (node) {
ko.applyBindings(_viewmodel, node);
};
return {
initialize: initialize,
bind: bind
};
})();
, javascript, javascript. , ? ?