mercredi 23 septembre 2015

Ember App.router. "App not defined"

I am trying to route my app for the very first time, but I don't quite understand the logic. I got my templates rendered when putting to my route.js file the following:

Router.map(function() {
  this.route('main', { path: '/' }, function() {

    this.route('helloworld', { path: '/'});
  });
});

Most of the examples seem to route with function App.router.map. First of all I don't quite understand what is the difference? Are the routes stored inside the app or what. And when I try to add this to route.js:

App.Router = Ember.Router.extend({
  enableLogging: true,
  location: 'hash'
});

App.Router.map(function() {
  this.route('main');
});

I get: "Uncaught ReferenceError: App is not defined". So what would be the right approach here and what am I missing out?




Aucun commentaire:

Enregistrer un commentaire