mercredi 31 janvier 2018

Why is Ember not rendering the template?

I just started playing around with Ember and stumbled upon a problem, of which I believe is pretty basic. Still, I can't figure out what's going on.

Specifically, after creating a new route with a dynamic segment, the template is never rendered, when visiting the according URL.

I'd like to visit localhost:8080/tournaments/1 and render a template named deathmatch.

Basically, I just created a new Ember-App and executed ember generate route deathmatch using ember-cli. After that, I changed the code inside the function passed to Router.map.

router.js

Router.map(function() {
    this.route('deathmatch', {path: '/tournaments/:tournament_id'});
});

templates/deathmatch.hbs

<span>Just some test output</span>

For testing purposes, I removed the second argument in this.route completely and visited localhost:8080/deathmatch. This works just as expected. Afterwards, I re-added the second argument, to be {path: ':tournament_id'}only. Visiting localhost:8080/1 also worked just fine. However, using the code as shown above, an empty page is being rendered.

Apparently, I'm misunderstanding Ember's documentation. So, can anyone point me in the right direction, as of what I'm not seeing here?




Aucun commentaire:

Enregistrer un commentaire