I am trying to create a class in a scope but cannot call the method I made for it. Why is this method not accessible?
Code Snippet
var ClientController;
(function($, cc){
function ClientController(){
this.GVNavUpdate = function(){
console.log('this works');
}
}
cc = new ClientController();
})(jQuery, ClientController);
ClientController.GVNavUpdate();
Try this out:
var ClientController = (function($) {
function ClientController() {
this.GVNavUpdate = function() {
console.log('this works');
}
}
return new ClientController();
})(jQuery);
ClientController.GVNavUpdate();
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.