I have a modal dialog, which is implemented similar to what is described in the cookbook: http://emberjs.com/guides/cookbook/user_interface_and_interaction/using_modal_dialogs/
I can close the modal without any problems via an event from the template. However, I have implemented a controller for the specific modal which creates a new model with the data that has been entered via the modal. Now I want to close the dialog after the model (after the controller is done) has been created. I tried various ways to send an action from a controller to the modal, however nothing worked so far. So, two questions:
How do I close the modal when the action in the controller is done?
export default ModalController.extend({ actions: { create: function() { // do some stuff var newModel = this.store.createRecord('newModel', { name: name }); newModel.save() // close modal // ... but how? }As this relies on promises, I think this would close the modal after the promise is created. How do I close the modal when the actual response from the server arrives and everything went fine?
closeModalaction for when to user closes the modal, to close the modal you can use theEm.TargetActionSupportmixin'striggerAction()method to setaction: 'closeModal', target: thisor something along those lines using the methos bguiz suggested. More info here. - Duncan Walker