jeudi 28 janvier 2016

Ember throws an error while injecting a service

I recently upgraded my Ember CLI to version 2.2.0 beta 6 and created a new Ember 2.3.0 project. Within it, I have service called ui which I am trying to inject into a route like this:

import Ember from 'ember';

export default Ember.Route.extend({
    ui: Ember.inject.service(),

    beforeModel: function() {
        this.get('ui').showMessage('Getting data');
    }
});

Ember logs the following error in the browser:

Uncaught Error: Attempting to inject an unknown injection: `service:ui`

I have checked and made sure that the UI service file - /app/services/ui.js is in fact there. In previous Ember.js projects (Ember version 1.13.0), I would do the exact same thing and it worked. What am I missing? Did anything change? I cannot find any changes in the documentation.




Aucun commentaire:

Enregistrer un commentaire