samedi 25 juin 2016

Ember - Attempting to register an unknown factory

I have my route structure like this:

abc (route)
    |-- index
    |       |-- route.js (extends base.js)
    |       |-- template.hbs
    |
    |-- edit
    |       |-- route.js (extends base.js)
    |       |-- template.hbs
    |
    |-- base.js (extends Ember.Route)

Now when I am trying to write the unit test for my base.js I am getting the following exception:

Promise rejected before it exists: Attempting to register an unknown factory: route:abc/base

What's wrong I have done that it isn't able to register my base class as route.?

If I change my base.js to route.js then it starts working, but what happen is that the afterModel inside base.js get executed twice when I make transition to abc/index(this is expected behavior). My base class contains code that is required by both of the index and edit route.

Is there any better way to deal with this.?




Aucun commentaire:

Enregistrer un commentaire