call controller in JavascriptMVC

2019-08-24 05:48发布

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条回答
我只想做你的唯一
2楼-- · 2019-08-24 06:37

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();

查看更多
登录 后发表回答