How to use parameters in render method


#1

In my application route, I have:

export default Ember.Route.extend({
  actions: {
    openModal: function(modal, opts) {
     
      return this.render(modal, {
        into: 'application',
        outlet: 'modal'
      });
    },
    closeModal: function() {
      return this.disconnectOutlet({
        outlet: 'modal',
        parentView: 'application'
      });
    }
  }
});

I have a general modal view:

import Ember from ‘ember’;

export default Ember.View.extend({
  tagName: 'div',
  classNames: 'modal'.w(),
  didInsertElement: function() {
    console.log("did insert element");
    this.$().attr('id', 'modal');
    this.$().modal({
      keyboard: false,
      backdrop: 'static'
    });
    
    return this.$().modal('show');
  },
  willDestroyElement: function() {
    return this.$().modal('hide');
  }
});

and a view specific to my modal:

import ModalView from '../modal';
export default ModalView.extend();

I want ‘opts’ (passed as an argument in openModal) to be processed so that I can fill the content of the modal depending on it.


#2

Alright, I found the answer myself:

http://stackoverflow.com/questions/28370503/how-to-pass-parameters-in-emberjs-render-method