0

Very basic example, but doesn't work. What i do wrong?

<body ng-app="App"></body>

<div ui-view="navbar"></div>
<div ui-view="sidebar"></div>
<div ui-view="content"></div>

<script>

    var App = angular.module('App', ['ui.router']);

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

        $urlRouterProvider.otherwise('/users');

        $stateProvider
            .state('users', {
                url: '/users',
                views: {
                    'navbar':  {template: '<p>Navigation</p>'},
                    'sidebar': {template: '<a href="#users/123">Link</a>'}
                }
            })
            .state('users.item', {
                url: '/:id',
                views: {
                    'content': {template: 'User info'}
                }
            });

    });

</script>

When click on link - app become 'users.item' state, but views.content will be not rendered

2
  • can u add a fiddle to show it not working? Commented Oct 8, 2013 at 0:12
  • from ui router docs plnkr.co/edit/SDOcGS?p=preview Commented Oct 8, 2013 at 0:13

1 Answer 1

1

You need to nest the content view in the template:

'sidebar': { template: '<a href="#users/123">Link</a><div ui-view="content"></div>' }

rather than having it in the body.

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.