Q:

EmberJS - check if template exists

How can I check if a template exists in an Ember Route object? 
I need to check this inside a route; if it does not exist, I will render a default template for that route. 
Many thanks! 

A:

To get the template you can use Ember.getOwner(this).lookup("template:foo") where foo is the name of the template.  If it returns null, then the template doesn't exist:
if (Ember.getOwner(this).lookup("template:foo")) {
  // render template foo
} else {
  // render default template
}

