0

Passing parameters from binder to controller

Hello,
Can you please tell me how to pass parameters from binder to controller?
The following code is not working

 Binder:
        bind: function(node) {
        
    ..
            this.mojitProxy.invoke('index1',{
             params: {"test": page}
          }, updateDOM);
      };

    ..
    };

Controller:

    index1: function(ac) {
    var page = ac.params.test;
var data = {
        channels: [
          {lcn:page}
        ]
      };
    ac.done(data,'json');
    }

by
3 Replies
  • I don't think that ac.params can be used like that. You should consider using ac.params.getFromMerged or something similar. Please check this link for details:
    http://developer.yahoo.com/cocktails/mojito/docs/code_exs/query_params.html
    0
  • Thanks for the reply..
    I have one more question..
    I tried the sample which is given in the following link:
    http://developer.yahoo.com/cocktails/mojito/docs/code_exs/htmlframe_view.html 

    It was working.Now I want to change the controller's affinity to client. So I did the following steps:
    - Renamed controller.server.js to controller.client.js
    - Set deploy property to true in appllication.json file

    After that it was not working.Can you please tell me what is wrong in the above steps. The error details are enclosed below:
     Error 404: Mojit controller prototype is not an object! (mojit id: 'undefined')
    Error: Mojit controller prototype is not an object! (mojit id: 'undefined')
        at Object.init (/opt/EPG/lib/node_modules/mojito/lib/app/autoload/controller-context.common.js:46:25)
        at Object.ControllerContext (/opt/EPG/lib/node_modules/mojito/lib/app/autoload/controller-context.common.js:21:14)
        at Object.<anonymous> (/opt/EPG/lib/node_modules/mojito/lib/app/autoload/dispatch.common.js:246:30)
        at [object Object]._notify (/opt/EPG/lib/node_modules/mojito/node_modules/yui3/node_modules/yui3-core/build/yui/yui-min.js:7:5959)
        at [object Object].__use (/opt/EPG/lib/node_modules/mojito/node_modules/yui3/node_modules/yui3-core/build/yui/yui-min.js:7:5669)
        at [object Object].use (/opt/EPG/lib/node_modules/mojito/node_modules/yui3/lib/node-yui3.js:637:24)
        at runMojit (/opt/EPG/lib/node_modules/mojito/lib/app/autoload/dispatch.common.js:286:45)
        at /opt/EPG/lib/node_modules/mojito/lib/app/autoload/dispatch.common.js:351:21
        at /opt/EPG/lib/node_modules/mojito/lib/app/autoload/resource-store-adapter.common.js:115:21
        at /opt/EPG/lib/node_modules/mojito/lib/store.server.js:414:13


    QUOTE(Fabian Frank @ 15 May 2012 10:55 AM)
    I don't think that ac.params can be used like that. You should consider using ac.params.getFromMerged or something similar. Please check this link for details:
    http://developer.yahoo.com/cocktails/mojito/docs/code_exs/query_params.html
    0
  • I assume that you get this error message in your server log? I am not sure if a Mojito today can live without having a controller available on the server side. I would recommend working with controller.common.js or creating a controller.client.js, instead of renaming.
    0

Recent Posts

in Yahoo! Mojito