To keep it short:
Is it possible to set up the Resolver
of the application outside of the Ember.Application.create()
block?
Ideally, I would like to set the Resolver
in a Ember.Application.initializer#initialize()
function. Something like:
import CustomResolver from 'appkit/utils/resolver/custom';
import CustomAjax from 'appkit/utils/ajax/custom';
Ember.Application.initializer({
name: 'resolver_setup',
initialize: function (container, application) {
// NOTE: For an unknown reason (unknown to me!) I can't import CustomAjax in CustomResolver...
application.set('Resolver', CustomResolver.create({ajax: CustomAjax.create({})});
}
});
Is this possible?
P.S.: The reason why I need a custom resolver is, that I'm fetching all templates from the server instead of delivering them to the user on application start. Therefore I'm extending the ember-jj-abrams-resolver
which is used by default within EAK...
I don't think initializers can help you to set a custom Resolver, according to the source code, container
is been set earlier than any initializers, resolver is a property of container.
You set the Resolver
property inside initializer, but this will not be used by the process of set up the container. I think the right way is to reopen the Ember.Application
and set the Resolver
before create the Ember.Application
.
Ember.Application.reopenClass({
Resolver: YOUR_CUSTOM_RESOLVER_NAME
});
Ember.Application.create({...});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With