vendredi 15 septembre 2017

Route page without ID - How to use another field?

I am trying to access a specific route with a specific field in my model.

All examples that I found in Ember's community use ID, but I am trying to use another one (which I will make sure to be unique).

My route config:

Router.map(function() {
  this.route('create-wedding');
  this.route('weddings');
  this.route('wedding', { path: 'wedding/:pageName' });
});

My link to the route:

Access

Try to get the record:

model(params) {
  return this.store.query('wedding', { orderBy: 'pageName', equalTo: params.pageName });
}

But, how to get the record for the specific param "pageName" in my Route model? And how to get the same record when the user access the page directly from the URL?

Thanks in advance




Aucun commentaire:

Enregistrer un commentaire