This is what i’ve doing to show a modal in ember.js:
components/modal-dialog.js
export default Ember.Component.extend({
init: function () {
this._super();
this.set('registerAs', this); // This stores the modal dialog in the bound property
}
});
controllers/application.js
export default Ember.Controller.extend({
actions: {
showModal: function () {
this.get('modalDialogName').send('show');
}
}
});
templates/application.hbs
{{#modal-dialog registerAs=modalDialogName}}
Hello
{{/modal-dialog}}
As you can se, I bound the registerAs
property of the component with the modalDialogName
property of the controller. The controller then can call the component from this property. This used to work in the past but after returning to ember.js after a break, this doesn’t work anymore. The component can read the value of modalDialogName
property, but cannot set it’s value. Anyone knows why?