0

Inside the root.app.work state or /work url, how do I change it's page template to <div>wtf</div>.

UPDATE: I cant get root.app.work.show to properly route? it goes to 404

//routes.js

.config(function ($stateProvider, $urlRouterProvider, $locationProvider ) {

    // $provide.decorator('$sniffer', function($delegate) {
    //   $delegate.history = false;
    //   return $delegate;
    // });
    $urlRouterProvider.otherwise('/404');
    $urlRouterProvider.when('/', '/menu');


    $stateProvider
    .state('root', {
      url: '/',
      abstract: true,
      views: {
        '': {
          templateUrl: 'components/main.html',
          controller: 'MainCtrl'
        },

      }
    })
    .state('root.app', {
      url: '',
      views: {
        'menu': {
          templateUrl: 'components/menu/menu.html',
          controller: 'MenuCtrl'
        },
        'page': {
          templateUrl: 'components/page/page.html',
          controller: 'PageCtrl'

        },
        'post': {
          templateUrl: 'components/post/post.html',
          controller: 'PostCtrl'
        },
      }
    })
    .state('root.app.menu', {
      url: 'menu',

    })
    //***********        UPDATEEEE **********//
    //*********** I wnat to change this one here **********//
    .state('root.app.work', {
  url: 'work',
  data: {
    pageTitle: 'work',
    description: 'work desc'
  },
  views: {
    'page@root': {
      template: 'work template view',

    },

  }
})
.state('root.app.work.show', {
  url: ':workSlug',
  data: {
    pageTitle: 'work',
    description: 'work desc'
  },
  views: {
    'page@': {
      template: 'work template view',

    },
    'post@root': {
      template: 'work post template view',

    },

  }
})
    .state('root.app.portfolio', {
      url: 'portfolio'
    })
    .state('root.app.blog', {
      url: 'blog'
    })
    .state('root.app.contact', {
      url: 'contact'
    });
    $locationProvider.html5Mode(false).hashPrefix('!');
  })

HTML:

//index.html
<body>

  <div ui-view></div>
</body>
//main.html
<div ui-view="menu"></div>
<div ui-view="page"></div>
<div ui-view="post"></div>
//all templates
<p>This is the {{view.name}} view.</p>
4
  • changing page@ to page@root might do it for you, Matthew. Give it a try and let me know. Commented Aug 1, 2014 at 5:09
  • You are truely amazing Verron. >_< if you wanna leave an answer I can mark it correct. Commented Aug 1, 2014 at 6:56
  • UGH I spoke too soon. Now how do I do the next level down? updated code Commented Aug 1, 2014 at 7:08
  • nm just a typo. mark it write Commented Aug 1, 2014 at 7:11

1 Answer 1

1

Changing page@ to page@root might do it for you

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.