mercredi 19 juillet 2017

Inject Ember service from subfolder

My current ember project is structured like this:

+-- app
| services 
|   +-- service1.js
|   |   subfolder
|   +-- service2.js

I have a service (service1.js) just in the root of the services folder. I can perfectly inject that into a controller like this:

    service: Ember.inject.service("service1"),

But I want some more structure in my services folder. I want to put a service (service2.js) in a subfolder ('subfolder').

How do I inject this into my http://ift.tt/2teWlBI? If I write down:

service: Ember.inject.service("subfolder/service2") or
service: Ember.inject.service("subfolder.service2"),

This doesn't work

Attempting to inject an unknown injection

How can I inject a service from a subfolder into my controller/component/etc ?




Aucun commentaire:

Enregistrer un commentaire