PUBLIC
Extends: Ember.Object
Defined in: packages/ember-application/lib/system/resolver.js:33
Module: ember-application
The DefaultResolver defines the default lookup rules to resolve container lookups before consulting the container for registered items:
Ember.TEMPLATES
controller:post looks up App.PostController by default.The container calls this object's resolve method with the fullName argument.
It first parses the fullName into an object using parseName.
Then it checks for the presence of a type-specific instance method of the form resolve[Type] and calls it if it exists. For example if it was resolving 'template:post', it would call the resolveTemplate method.
Its last resort is to call the resolveOther method.
The methods of this object are designed to be easy to override in a subclass. For example, you could enhance how a template is resolved like so:
App = Ember.Application.create({
Resolver: Ember.DefaultResolver.extend({
resolveTemplate: function(parsedName) {
let resolvedTemplate = this._super(parsedName);
if (resolvedTemplate) { return resolvedTemplate; }
return Ember.TEMPLATES['not_found'];
}
})
});
Some examples of how names are resolved:
'template:post' //=> Ember.TEMPLATES['post']
'template:posts/byline' //=> Ember.TEMPLATES['posts/byline']
'template:posts.byline' //=> Ember.TEMPLATES['posts/byline']
'template:blogPost' //=> Ember.TEMPLATES['blogPost']
// OR
// Ember.TEMPLATES['blog_post']
'controller:post' //=> App.PostController
'controller:posts.index' //=> App.PostsIndexController
'controller:blog/post' //=> Blog.PostController
'controller:basic' //=> Ember.Controller
'route:post' //=> App.PostRoute
'route:posts.index' //=> App.PostsIndexRoute
'route:blog/post' //=> Blog.PostRoute
'route:basic' //=> Ember.Route
'view:post' //=> App.PostView
'view:posts.index' //=> App.PostsIndexView
'view:blog/post' //=> Blog.PostView
'view:basic' //=> Ember.View
'foo:post' //=> App.PostFoo
'model:post' //=> App.Post
Boolean
Object
Used to iterate all items of a given type.
String
Returns a human-readable description for a fullName. Used by the Application namespace in assertions to describe the precise name of the class that Ember is looking for, rather than container keys.
String
Convert the string name of the form 'type:name' to a Javascript object with the parsed aspects of the name broken out.
String
Objectpublic
This method is called via the container's resolver method. It parses the provided fullName and then looks up and returns the appropriate template or class.
String
Object Lookup the controller using resolveOther
Object
Look up the specified object (from parsedName) on the appropriate namespace (usually on the Application)
Object
Lookup the model on the Application namespace
Object
Look up the specified object (from parsedName) on the appropriate namespace (usually on the Application)
Object
Lookup the route using resolveOther
Object
Look up the template in Ember.TEMPLATES
Object
Lookup the view using resolveOther
Object
Converts provided name from the backing namespace into a container lookup name.
Examples:
App.FooBarHelper -> helper:foo-bar App.THelper -> helper:t
Given a parseName object (output from parseName), apply the conventions expected by Ember.Router
Object
This will be set to the Application instance when it is created.
© 2017 Yehuda Katz, Tom Dale and Ember.js contributors
Licensed under the MIT License.
http://emberjs.com/api/classes/Ember.DefaultResolver.html