Ember.js: How to inherit custom "abstract" route in ember-cli?


I have started with ember and ember-cli. Ember-cli is somewhat different than Ember shown in most of the tutorials.

I can not understand what do I need to do to inherit my own custom “Route”. For example I made a file:


and in it:

AuthenticatedRoute = Ember.Route.extend

Now I want to do the following:

     make a new file called secret.coffee with:

     SacretRoute = AuthenticatedRoute.extend

The best I got so far is import AuthenticatedRoute from ‘…/routes/authenticated’ which says that it included the file but says that it can not do .extend on undefined.


From what I gather in your question, your authenticated.js (I dont know coffeescript sytax) should be in your routes folder and look like:

import Ember from 'ember';

export default Ember.Route.extend({
  // route stuff

Since the CLI uses ES6 modules the name of the file needs to be the name of the route. Make sure you have the broccoli coffeescript compiler bit as well.

In your router.js you should also have something like: