jeudi 16 août 2018

Something about dynamic segments in ember.js?

I am a new starter in ember.js, and recently i get a problem like this

Assertion Failed: You attempted to define a `` but did not pass the parameters required for generating its dynamic segments. More context objects were passed than there are dynamic segments for the route: cryptid

I will show my code below and Anyone can explain what’s wrong and how to fix it?

in models(cryptid.js)

import DS from 'ember-data';

export default DS.Model.extend({
  name: DS.attr('string'),
  cryptidType: DS.attr('string'),
  profileImg: DS.attr('string'),
  sightings: DS.hasMany('sighting')
});

in routes(crypteds.js)

import Route from '@ember/routing/route';

export default Route.extend({
  model(){
    return this.store.findAll('cryptid');
  }
});

in cryptids.hbs

<div class="row">
  
    <div class="col-xs-12 col-sm-3 text-center">
      <div class="media well">
        
          <img class="media-object thumbnail" src="" alt="" width="100%" height="100%">
        
        <div class="caption">
          <h3></h3>
        </div>
      </div>
    </div>
    
      <div class="jumbotron">
        <h1>No Creatures</h1>
      </div>
  
</div>

in router.js

Router.map(function() {
  this.route('sightings', function() {
    this.route('new');
  });
  this.route('sighting', function() {
    this.route('edit');
  });
  this.route('cryptids');
  this.route('cryptid'), {path: 'cryptids/:cryptid_id'};
  this.route('witnesses');
  this.route('witness');
});




Aucun commentaire:

Enregistrer un commentaire