How to: Turn off or Disable Ember.js Router - Byron Salau

Posted by | August 16, 2013 | javascript | No Comments

Ember really strongly pushes you to use Ember only for pure Ember web applications. Though there are a few of us that like to nest Ember just for a single component on a webpage. While it can be debated that Backbone or Angular is better suited to this situation I personally still really like to use Ember.

The problem with this is Ember has a Router that tries to match views with URL hash-bangs (!#). If your webpage containing the Ember component on it also uses hash-bangs you are going to get conflicts and might see the following error

Uncaught Error: No route matched the URL '...'

The solution in most cases is to turn off the Router as you’re most likely not using it in this situation.

To Disable The Ember Router

Ember allows us to use our own Routers, which is handy for us so we can pass in null or no Router like so:

Ember.Application.create({ Router: null })