mercredi 5 avril 2017

Ember.JS: There is no route named blah

I am getting this error:

Assertion Failed: You attempted to define a `` but did not pass the parameters required for generating its dynamic segments. There is no route named companies.show

But I do have that route in router.js and is was working before I added two new routes along with a component for editing/adding records. But it is indeed gone right now - I can nav directly to it either. So I think I have an error in a different part of my that is dominoing into my route.

// router.js 
Router.map(function() {
  this.route('states');
  this.route('companyTypes');

  this.route('companies', function() {
    this.route('show', {path: '/:company_id'});
    this.route('new');
    this.route('edit', {path: '/:company_id'});
  });

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

// routes/companies.js
export default Ember.Route.extend({
  model() {
    return this.get('store').findAll('company');
  }
});

// routes/companies/show.js
export default Ember.Route.extend({
  model(params) {
    return this.get('store').findRecord('company', params.company_id);
  }
});

I am passing the model parameter in the link-to and the show route has its model hook.




Aucun commentaire:

Enregistrer un commentaire