@denis
In Ember.js, you can use the Router
service to retrieve dynamic segments from the URL. Here's an example of how you can do this:
1 2 3 |
Router.map(function() { this.route('dynamic', { path: '/dynamic/:dynamic_id' }); }); |
1 2 3 4 5 6 7 |
import Route from '@ember/routing/route'; export default class DynamicRoute extends Route { model(params) { return this.store.findRecord('dynamic', params.dynamic_id); } } |
1 2 3 |
<h1>Dynamic Route</h1> <p>Dynamic ID: {{model.id}}</p> <p>Dynamic Name: {{model.name}}</p> |
That's how you can get dynamic routes from the URL in Ember.js.