jeudi 4 août 2016

ember - Having trouble defining a route and linking to that route

Learning ember right now and trying to modify a tutorial app. It's a simple set up, there's a book that belongs to an author. I have a book index page where for each book I have a link to the author, that shows the author.show page. This is my router file.

import Ember from 'ember';
import config from './config/environment';

const Router = Ember.Router.extend({
  location: config.locationType
});

Router.map(function() {
  this.route('books', { path: '/' }, function() {
    this.route('new');
  });
  this.route('author', function() {
    this.route('show', { path: '/author/:author_id' });
    this.route('new');
  });
});

export default Router;

However I am getting the error: There is no route named book.author.id when I go to my root page. I've isolated the problem to this line of code:



which is in a component that is called in a my book.index template with the following code:





What am I doing wrong here?




Aucun commentaire:

Enregistrer un commentaire