Using resolver to look up domain-specific types

Has anyone added new lookup types to the resolver specifically for your app? For example, within my app, I have a base class called “StatGroup” and a bunch of objects that extend from it. It seems like it might make sense to be able to do:

App.__container__.lookup("statgroup:name")

to dynamically get an instance of that object. I’m sure it’s possible to do, but has anyone actually used the new resolver in this way? Any reason I wouldn’t want to do it?

So I noticed that this actually works without any customization. So if I name my object App.NameStatGroup, I can query the container for: "stat-group:name" and get it back. Nice one Ember!

2 Likes

In case people would like more information: http://emberjs.com/api/classes/Ember.DefaultResolver.html

This kinda raises the question if we want the container to be used this way, since App.__container__ is a private API, but as you said, in some cases it might make good sense.