Load data into modal dialog


#1

Hello,

I want to load different (unrelated) data (e.g. order and users ) into modal dialog ? Could you explain or suggest me the best way of doing this ? Currently I have such a piece of code (I don’t use ember-data, I use $.getJSON for getting data):

App.ApplicationRoute = Ember.Route.extend({
    actions: {
    ...
    openModal: function(modalName, model) {
       this.controllerFor(modalName).set('model', model);
       return this.render(modalName, {
             into: 'application',
             outlet: 'modal',
             view: 'modal'
       });
    },

   openMyModalDialog: function(order) {
       **how to load additional data for model e.g. users **
        var model = { order: order, user: ? }
        this.send('openModal', 'myModalName', model);
   },
   ...

myModalDialog.hbs have action:

{{action 'openMyModalDialog' order}}

Thanks in advance.


#2

I’m sure this is not the Ember way to do things but I needed two collections rendered on one page so I did this:

var dataContainer = {collection1: [], collection2: []};

Then in my handle bars:

{{#each item in model.collection1}}...

Then I could show both collections on one page with one backing object.