call controller in JavascriptMVC

纵饮孤独 提交于 2019-12-25 00:40:52

问题


I have two controllers, init:

jQuery.Controller.extend('App.Controllers.Init', {  
    onDocument: true  

},{  
    load: function() {  
        //call App.Controllers.Tabs on $('#tabs')  
        //it is not that easy as $('#tabs').tabs() -> Throws: Object doesn't support this property or method  
    }
});

And tabs:

jQuery.Controller.extend('App.Controllers.Tabs,...

How to call tabs in init?


回答1:


You need to:
$('#tabs').app_tabs()
Just cut the "controller" word out. Make all letters lowercase, and change dots "." to "_"

One More Example:
controller definition:
jQuery.Controller.extend('Appname.Controllers.Controllername',...
call it:
$('#some_id').appname_controllername();



来源:https://stackoverflow.com/questions/4623728/call-controller-in-javascriptmvc

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!