javascript - Customize Ember View in route.render() call (or an alternative) -


i'm trying create generic modal dialog view, can call controller in app. have working:

app.modalmanaging = ember.mixin.create({ actions: {     openmodal: function (modalname, model, callback) {         this.controllerfor(modalname)             .set("model", model);         this.set("modal", {             callback: callback,             name: modalname         });         this.render(modalname, {             into: "application",             outlet: "modal",             controller: "application",             view: "modal"         });     }     //... other stuff }); 

so, each modal, create separate controller class , set supplied object model. use render() method render modal view/controller/template 'modal' socket in main layout. way modal collects user actions , provides response calling controller outside scope of question. suffice say, part works.

well part works too, don't it. controller per modal seems overkill. need view few properties, communicate directly application route.

so last few hours, i've been trying somehow customize view object used render() method.

this doesn't work:

this.render(modalname, {     into: "application",     outlet: "modal",     controller: "application",     view: new app.modalview({         message: "are sure?"     }) }); 

i going through ember source , seems there's nothing either:

this.render(modalname, {     into: "application",     outlet: "modal",     controller: "application",     view: "modal",     viewhash: {         message: "are sure?"     } }); 

basically, need programmatic equivalent of {{view}} helper, including ability provide own hash.

i suppose use fixed containerview instead of empty outlet , manipulate that, seems equality clunky modal controllers.

any ideas on how achieve or similar appreciated.

update: way using private router._lookupactiveview() method.

var modalview = app.modalview.create({     templatename: modalname,     message: "are sure?" }); this.router._lookupactiveview("application")     .connectoutlet("modal", modalview); 

this seems working, i'm not sure using private method better clunky solutions controller->model , containerview.

still looking 1 solid, canonical solution.


Comments

Popular posts from this blog

android - Get AccessToken using signpost OAuth without opening a browser (Two legged Oauth) -

org.mockito.exceptions.misusing.InvalidUseOfMatchersException: mockito -

google shop client API returns 400 bad request error while adding an item -