dimanche 22 novembre 2015

"Application Actions" in Ember 2.1

I'm trying to create a modal for my users to signin, so I have this link:

<li><a {{action "signin"}}>Sign In</a></li>

in a {{planhw-navbar}} component.

{{planhw-navbar signin=(action "showModal" name="signin-modal")}}

But when I open my browser, I get the error:

An action named 'showModal' was not found in (generated application controller)

I've tried putting an action in a controller, a route, and a component:

import Ember from 'ember';

export default Ember.Component.extend({
  actions: {
    showModal: function(name) {
      this.render(name, {
        into: 'application',
        outlet: 'modal'
      });
    }, //...
  }
})

My component, {{signin-modal}}, works correctly.

My entire application.hbs:

{{planhw-navbar signin=(action "showModal" name="signin-modal")}}
{{outlet}}
{{outlet 'modal'}}




Aucun commentaire:

Enregistrer un commentaire