Skip to content

Instantly share code, notes, and snippets.

@serenaf
Created November 7, 2017 10:31
Show Gist options
  • Save serenaf/d8c4340630be9e40de1c0552d29c7dd8 to your computer and use it in GitHub Desktop.
Save serenaf/d8c4340630be9e40de1c0552d29c7dd8 to your computer and use it in GitHub Desktop.
Adding dynamic item route
import Route from '@ember/routing/route';
export default Route.extend({
model(params) {
return this.get('store').findRecord('item', params.id);
}
});
import EmberRouter from '@ember/routing/router';
import config from './config/environment';
const Router = EmberRouter.extend({
location: config.locationType,
rootURL: config.rootURL
});
Router.map(function() {
this.route('frontpage');
this.route('new');
this.route('jobs');
this.route('ask');
this.route('active');
this.route('show');
this.route('item', { path: '/item/:id' });
});
export default Router;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment