samedi 10 janvier 2015

How to subclass an Ember class using ES6 syntax in Ember CLI

I'd like to create a custom Route class in Ember CLI. I have the following example working in an older app written with globals:



App.AuthenticatedRoute = Ember.Route.Extend({
beforeModel: function() {
//Do some things
}
});

App.DashboardRoute = App.AuthenticatedRoute.Extend({});


I'm familiar enough with ES6 modules to know that the example would look something like this...



var AuthenticatedRoute = Ember.Route.Extend({
beforeModel: function() {
//
}
});

export default AuthenticatedRoute;


...but I'm curious about the following:



  1. Where would this live in the app structure?

  2. How do I access this subclass in other modules?





Aucun commentaire:

Enregistrer un commentaire