mardi 2 août 2016

Send actions to the Application controller in EmberJS

I'm trying to toggle a global property on the application controller, by clicking a button on one of the templates. I've read some stuff on action bubbling but can't it to work.

Here's the property and action on the Application controller

export default Ember.Controller.extend({
  isAuthenticated: true,
  actions: {
    logIn: function(){
      this.toggleProperty('isAuthenticated');
    }
  }
});

And here's the action with a login.hbs template file (I'll turn this into a proper button soon)

<span >
    Login
</span> 

How could I ensure the action toggles the property on the Application Controller?




Aucun commentaire:

Enregistrer un commentaire