Advertisement
Guest User

Untitled

a guest
Apr 2nd, 2015
227
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.01 KB | None | 0 0
  1. ## First Approach
  2.  
  3. ```js
  4. this.route('plans', { path: '/plans' }, function () {
  5. // index is for list of all plans
  6. this.route('new');
  7. });
  8.  
  9. this.route('plan', { path: '/plans/:plan_id' }, function () {
  10. // index is for viewing the single record
  11. this.route('edit');
  12. });
  13. ```
  14.  
  15. ### pros
  16.  
  17. * Load singular model only once
  18. * Distinction in transitions, e.g. `transitionTo('plans')` vs `transitionTo('plan')`.
  19.  
  20. ### cons
  21.  
  22. * Two folders in pods structure
  23. * Distinction in transition names can be missed easily, one letter difference.
  24.  
  25.  
  26. ## Second Approach
  27.  
  28. ```js
  29. this.route('plans', function () {
  30. //index is for list of all plans
  31. this.route('view', { path: ':plan_id' });
  32. this.route('edit', { path: ':plan_id/edit' });
  33. this.route('new');
  34. });
  35. ```
  36.  
  37. Can alternatively have a `this.route('list', { path: '/' })` to be more verbose.
  38. Names could also be 'one' & 'many', 'single' & 'plural', 'one' & 'all', 'view' & 'list', etc..
  39.  
  40. ### pros
  41.  
  42. * Verbose naming scheme
  43. * All in one folder
  44.  
  45. ### cons
  46.  
  47. * No top down model loading for singular routes
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement