Alex Coleman
Alex Coleman

Reputation: 681

In Ember pre4's router, how do you trigger a route event from within another route?

I have code such as that shown below, and I'm just wondering how I can trigger another event within the route's events. Thoughts?

App.MyRoute = Ember.Route.extend({

events: {
  eventOne: function() {
     // do something
  },
  eventTwo: function() {
     // how do I call eventOne() here?
  },
}

});

Upvotes: 0

Views: 236

Answers (1)

Wildhoney
Wildhoney

Reputation: 4969

You can just call events.eventOne() using this as the context:

App.IndexRoute = Ember.Route.extend({
    events: {
        eventOne: function() {
            console.log('You got me!');
        },
        eventTwo: function() {
            this.events.eventOne();
        },
    } 
});

Upvotes: 2

Related Questions