Wang Liu
Wang Liu

Reputation: 11

ember trigger action from console

App = Ember.Application.create();

posts = [{
  title: "Rails is omakase",
  body: "There are lots of à la carte software environments in this world."
}, {
  title: "Broken Promises",
  body: "James Coglan wrote a lengthy article about Promises in node.js."
}];

App.IndexRoute = Ember.Route.extend({
  model: function() {
    return posts; 
  }
});

App.PostSummaryComponent = Ember.Component.extend({
  actions: {
    toggleBody: function() {
      this.toggleProperty('isShowingBody');
    }
  }
});

What do I suppose to do if I want to call toggleBody function from my browser console. The above code is presented in ember.js document, http://emberjs.com/guides/components/handling-user-interaction-with-actions/

Upvotes: 1

Views: 623

Answers (1)

Alex Heyd
Alex Heyd

Reputation: 1333

This is a really old thread, but from devtools you can do:

App.__container__.lookup('component:post-summary').send('toggleBody');

Upvotes: 1

Related Questions