I am in the process of migrating my map form Ember.1.12 to Ember.1.13.8
I recently opened this issue: http://ift.tt/1JyjYGt because my store namespace was no longer applied when transitioning from RESTAdapter to JSONAPIAdapter
I have custom stores that are loaded with initializers:
Ember1.12 Code
initialize = (container, app) ->
config = container.lookup('config:main')
store = DS.Store.extend
adapter: DS.RESTAdapter.extend
namespace: 'v1/crm'
auth: container.lookup('auth-manager:main')
headers: (->
'Authorization': @get('auth.token')
'Content-Type': 'application/json'
'Accept': 'application/json-ember'
).property('auth.token')
app.register 'crm-provisioning:main', store
app.inject 'route', 'crm-provisioning', 'crm-provisioning:main'
app.inject 'controller', 'crm-provisioning', 'crm-provisioning:main'
app.inject 'component', 'crm-provisioning', 'crm-provisioning:main'
CrmProvisioningInitializer =
name: 'crm-provisioning'
after: ['config', 'auth-manager']
initialize: initialize
`export {initialize}`
`export default CrmProvisioningInitializer`
Now, for Ember 1.13 it was mentioned in the issue I opened, that I should be using stores as services: http://ift.tt/1Q8wsJh
I am unsure about how to refactor that code.
-
How will I access the other initializers that I was previously looking up through the container?
-
Does it mean I need to move all my initializers to services? For example the config initializer
-
Is there an easy way to inject the services in all routes,controllers, and components? Apparently this can be done through instance initializers(Which I am really confused about), but how does this fit with stores as services?
Aucun commentaire:
Enregistrer un commentaire