Question

Ok, being minimalist, I have an index.html that has

<html>
  <body>
    hello world
    <script type="text/x-handlebars" data-template-name="lists">
      <h1>in route lists</h1>
    </script> 
    <script src="http://builds.emberjs.com/beta/ember.js"></script>
    <script src="app.js"></script>
  </body>
</html>

and an app.js with

var App = window.App = Ember.Application.create({
   LOG_TRANSITIONS: true
});
App.Router.map(function() {
   this.resource('lists');
});

Shouldn't that be enough to get me a page with 'in route lists' when I navigate to AppURL/lists?

Was it helpful?

Solution

This is enough to get you a page with 'in route lists'. The page will be at APP_URL/#/lists though as by default ember uses the browsers hash for routing. If you wish to use hashless urls you need to tell your router to use the HTML5 history API:

App.Router.reopen({
  location: 'history'
});

You can read more about this here: http://emberjs.com/guides/routing/specifying-the-location-api/

and find a JSBin to play about here: http://emberjs.jsbin.com/seweqedi/2/

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top