0

my app is here http://ui-router2-dwilbank68.c9.io/

I know ui-router is loading correctly because the NAMED views are functioning correctly (click About). The nested views list and paragraph, however, are not working, and I've looked over the code a dozen times for discrepancies. No errors in the Chrome console either.

here is the view I am trying to do the nesting in...

<div class="jumbotron text-center">
    <h1>The Homey Page</h1>
    <p>This page demonstrates nested views.</p>

    <a ui-sref='.list' class='btn btn-primary'>List</a>
    <a ui-sref='.paragraph' class='btn btn-primary'>Paragraph</a>
</div>

and here is my entire javascript content

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

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

    $urlRouterProvider.otherwise('/home');

    $stateProvider

        // HOME STATES AND NESTED VIEWS ========================================
        .state('home', {
            url: '/home',
            templateUrl: 'partial-home.html'
        })

        .state('home.list', {
            url: '/list',
            templateUrl: 'partial-home-list.html',
            controller: function($scope){
                $scope.dogs = ['Bernese','Husky','Goldendoodle'];
            }
        })

        .state('home.paragraph', {
            url: '/paragraph',
            template: 'I could use a taco right now'
        })

        // ABOUT PAGE AND MULTIPLE NAMED VIEWS =================================
        .state('about', {
            url: '/about',
            views: {
                '': {templateUrl: 'partial-about.html'},

                'columnOne@about': { template: 'Look I am a column' },

                'columnTwo@about': {
                    templateUrl: 'table-data.html',
                    controller: 'scotchController'
                }
            }
        });
});

routerApp
    .controller('scotchController', function($scope){
        $scope.message = 'test';
        $scope.scotches = [
        { name: 'Macallan 12', price: 50 },
        { name: 'Chivas Regal Royal Salute', price: 10000 },
        { name: 'Glenfiddich 1937', price: 20000 } ];
});

The url DOES change... but why do the templates not load??

2
  • Can we have a plnkr, your code looks right. Maybe i usually use ui-sref='home.list'. Commented Oct 1, 2015 at 7:52
  • Is this workable just like plunker? ide.c9.io/dwilbank68/ui-router2 The RUN button is at the top, and I've already provided the URL to see the live preview of the page... Commented Oct 1, 2015 at 7:58

1 Answer 1

2

You probably missed <div ui-view></div> in your home view (partial-home.html)

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

1 Comment

You know, I was wondering, "This is weird... Why is there no spot for the child view to go?" And there it is... Thanks!

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.