mercredi 2 août 2017

Ember 2, Simply modals as components, not controllers

I searched but nothing made me happy.

I found this: http://ift.tt/1neM9CH

But he's using controller. I need to use components.

How can I use this code for component?

app/routes/application.js

showModal(name, model) {
  console.log('showModal() in application.js called!');
  this.render('components/' + name, {
    into: 'application',
    outlet: 'modal',
    model: model
  });
},

removeModal() {
  console.log('removeModal() in application.js called!');
  this.disconnectOutlet({
    outlet: 'modal',
    parentView: 'application'
  });
}

this.render just renders, of course, the .hbs of my component. The code (like didInsertElement) of that component is not executed.

Maybe with a fake template in templates folder? But how?




Aucun commentaire:

Enregistrer un commentaire