To properly set up abstraction, make sure to include abstract:true in the 'father' root element like this:
var routerApp = angular.module('routerApp', ['ui.router','ncy-angular-breadcrumb']);
routerApp.config(function($stateProvider, $urlRouterProvider) {
$urlRouterProvider.otherwise('/home/list');
$stateProvider
// HOME STATES AND NESTED VIEWS ========================================
.state('home', {
url: '/home',
abstract: true,
templateUrl: './partial-home.html'
})
// nested list with custom controller
.state('home.list', {
url: '/list',
templateUrl: './partial-home-list.html',
controller: function($scope) {
$scope.dogs = ['Bernese', 'Husky', 'Goldendoodle'];
}
})
.state('home.second', {
url: '/second',
templateUrl: './second.html',
});
});
routerApp.run(['$rootScope', '$state', function ($rootScope, $state) {
$rootScope.$on('$stateChangeStart', function (event, toState) {
console.log("state Change")
});
}]);
Keep in mind that when using abstract: true, the URL acts as a prefix and cannot be called directly in the .otherwise() function.
Including the second view in your routing, simply remove the .list like so:
.state('home.second', { //<-- REMOVE THE .list HERE
url: '/second',
templateUrl: './second.html',
});
In the link, update it accordingly:
// UPDATE IT LIKE THIS..
<a ui-sref="home.second" class="btn btn-danger">Second Nested</a>