Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ## First Approach
- ```js
- this.route('plans', { path: '/plans' }, function () {
- // index is for list of all plans
- this.route('new');
- });
- this.route('plan', { path: '/plans/:plan_id' }, function () {
- // index is for viewing the single record
- this.route('edit');
- });
- ```
- ### pros
- * Load singular model only once
- * Distinction in transitions, e.g. `transitionTo('plans')` vs `transitionTo('plan')`.
- ### cons
- * Two folders in pods structure
- * Distinction in transition names can be missed easily, one letter difference.
- ## Second Approach
- ```js
- this.route('plans', function () {
- //index is for list of all plans
- this.route('view', { path: ':plan_id' });
- this.route('edit', { path: ':plan_id/edit' });
- this.route('new');
- });
- ```
- Can alternatively have a `this.route('list', { path: '/' })` to be more verbose.
- Names could also be 'one' & 'many', 'single' & 'plural', 'one' & 'all', 'view' & 'list', etc..
- ### pros
- * Verbose naming scheme
- * All in one folder
- ### cons
- * No top down model loading for singular routes
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement