App.Resolver = EmberDefaultResolver.extend({
resolveTemplate: function(parsedName){
var t = this._super(parsedName);
if App.mobileActive){
return this._super('mob_' + parsedName) || t;
}
return t;
}
});
I’m using Ember-App-Kit which uses the jj-abrams resolver. AFIK this is an experimental resolver that may inform future versions of core. Is it possible to do the same thing with the new/experimental resolver? How? I’ve been contorting that code for a while and I can’t get it to do that trick.
Is the ease of extensibility there a feature to keep in the new resolver?
In Ember App Kit it should be possible to do something like the following:
import JJAbramsResolver from 'ember/resolver';
var AppkitResolver = JJAbramsResolver['default'];
var MyResolver = AppkitResolver.extend({
resolveTemplate: function (parsedName) {
// your code goes here
}
});
export default MyResolver;
and you can use it in your app like:
import MyResolver from 'appkit/utils/my-resolver';
var App = Ember.Application.create({
modulePrefix: 'appkit',
Resolver: MyResolver
});
export default App;
var MyResolver = AppkitResolver.extend({
resolveTemplate: function (parsedName) {
// your code goes here
}
});
Sure that can be done, it’s just the "your code goes here" part needing clarification. Apparently the parsedName object has changed, before it was a string but now is an object with a few properties representing what the string used to. Evidently the important property is parsedName.fullNameWithoutType so I was able to do this with:
So this is still possible, my only suggestion would be that there could be some comments on the parsedName object as its details are not very clear to an outside reader currently.