Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- app.get('/home'... {user: req.user})
- app.config(['$stateProvider', '$urlRouterProvider',
- function($stateProvider, $urlRouterProvider){
- $stateProvider.state('home',{
- url: '/home',
- templateUrl: '/home.html',
- controller: 'MainCtrl', //initializes with this ctrl, no need to specify earlier
- resolve: {
- postPromise: ['posts', function(posts){
- return posts.getAll();
- }]
- }
- });
- $stateProvider.state('posts', {
- url: '/posts/{id}',
- templateUrl: '/posts.html',
- controller: 'PostsCtrl',
- resolve: {
- post: ['$stateParams', 'posts', function($stateParams, posts){
- return posts.get($stateParams.id);
- }]
- }
- });
- $stateProvider.state('landing', {
- url: '/landing',
- templateUrl: '/landing.html',
- controller: 'landCtrl',
- });
- $urlRouterProvider.otherwise('home');//otherwise go here
- }]);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement