Advertisement
Guest User

Untitled

a guest
Dec 21st, 2014
144
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.07 KB | None | 0 0
  1. app.get('/home'... {user: req.user})
  2.  
  3. app.config(['$stateProvider', '$urlRouterProvider',
  4. function($stateProvider, $urlRouterProvider){
  5. $stateProvider.state('home',{
  6. url: '/home',
  7. templateUrl: '/home.html',
  8. controller: 'MainCtrl', //initializes with this ctrl, no need to specify earlier
  9. resolve: {
  10. postPromise: ['posts', function(posts){
  11. return posts.getAll();
  12. }]
  13. }
  14. });
  15. $stateProvider.state('posts', {
  16. url: '/posts/{id}',
  17. templateUrl: '/posts.html',
  18. controller: 'PostsCtrl',
  19. resolve: {
  20. post: ['$stateParams', 'posts', function($stateParams, posts){
  21. return posts.get($stateParams.id);
  22. }]
  23. }
  24. });
  25. $stateProvider.state('landing', {
  26. url: '/landing',
  27. templateUrl: '/landing.html',
  28. controller: 'landCtrl',
  29. });
  30. $urlRouterProvider.otherwise('home');//otherwise go here
  31. }]);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement