Reputation: 2316
I want to use Javascript Module Pattern
with Knockout JS and Pager JS
, i know how to use Javascript Module Pattern
and Knockout JS and Pager JS
Separately but i don't know how to integrate them.Here is my code of Javascript Module Pattern
var Module = (function(){
var my = {};
my.testMethod = function(){
alert("test method is called");
};
return my;
}());
(function(anyobj){
anyobj.anotherMethod = function(){
alert("another Method is called");
};
anyobj.testMethod();
}(Module));
now this code work find but i don't know how to integrate the above code with the given below code in order to make knockout js and pager js
work fine with Javascript Module Pattern
var moduleViewModel = new Module();
pager.extendWithPage(moduleViewModel);
ko.applyBindings(moduleViewModel);
pager.start();
Upvotes: 0
Views: 238
Reputation: 2316
Update the following code with this one and this should work
var Module = (function(){
var my = {};
my.testMethod = function(){
alert("test method is called");
};
return my;
}());
(function(anyobj){
anyobj.anotherMethod = function(){
alert("another Method is called");
};
anyobj.testMethod();
}(Module));
//--- Module is an Object so we can pass it to a function as an argument ---//
pager.extendWithPage(Module);
ko.applyBindings(Module);
pager.start();
Upvotes: 1