routes.js 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. /*
  2. Configure routes used with ngRoute. We chose not to use $locationProvider.html5Mode(true);
  3. because using HTML5 pushstate requires that server routes are setup to mirror the routes
  4. in this file. Since this isn't a node course we're going to skip it. For all intensive
  5. purposes, html5 mode and url hash mode perform the same when within an angular app.
  6. */
  7. angular.module('NoteWrangler').config(['$routeProvider', function($routeProvider) {
  8. $routeProvider
  9. .when('/', {
  10. // redirect to the notes index
  11. redirectTo: '/notes'
  12. })
  13. .when('/users', {
  14. templateUrl: 'templates/pages/users/index.html',
  15. controller: 'UsersIndexController'
  16. })
  17. .when('/users/:id', {
  18. templateUrl: 'templates/pages/users/show.html',
  19. controller: 'UsersShowController'
  20. })
  21. .when('/notes', {
  22. templateUrl: 'templates/pages/notes/index.html',
  23. controller: 'NotesIndexController'
  24. })
  25. .when('/notes/new', {
  26. templateUrl: 'templates/pages/notes/edit.html',
  27. controller: 'NotesCreateController'
  28. })
  29. .when('/notes/:id', {
  30. templateUrl: 'templates/pages/notes/show.html',
  31. controller: 'NotesShowController'
  32. })
  33. .when('/notes/:id/edit', {
  34. templateUrl: 'templates/pages/notes/edit.html',
  35. controller: 'NotesEditController'
  36. })
  37. .when('/profile/edit', {
  38. templateUrl: 'templates/pages/profile/edit.html',
  39. controller: 'ProfileEditController'
  40. })
  41. .otherwise({redirectTo: '/'});
  42. }]);