Hello! My latest project is this app I've created:
var accolade = angular.module('accolade', [
'ui.router',
'personControllers',
'personFactories'
]);
accolade.config(['$stateProvider', '$urlRouterProvider', function($stateProvider, $urlRouterProvider) {
$urlRouterProvider.
otherwise('/list');
$stateProvider.state('list', {
url: '/list',
resolve: {
headerFactory: function(headerFactory) {
return headerFactory;
}
},
views: {
'main': {
templateUrl: 'partials/list.html',
controller: 'ListController'
},
'header': {
templateUrl: 'partials/header.html',
controller: 'HeaderController'
},
'breadcrumb': {
templateUrl: 'partials/breadcrumb.html',
controller: function($scope) {
$scope.breadcrumb = ['Home', 'Library', 'Data'];
}
},
'sidebar': {
templateUrl: 'partials/sidebar.html'
}
}
}).
state('details', {
url: '/details/:id',
resolve: {
headerFactory: function(headerFactory) {
return headerFactory;
}
},
views: {
'header': {
templateUrl: 'partials/header.html',
controller: 'HeaderController'
},
'main': {
templateUrl: 'partials/details.html',
controller: 'DetailsController'
},
'breadcrumb' : {
templateUrl: 'partials/breadcrumb.html',
controller: function($scope) {
$scope.breadcrumb = ['Home', 'Library', 'Details'];
}
},
'sidebar': {
templateUrl: 'partials/sidebar.html'
}
}
});
}]);
I'm pleased with how the app functions, but I am considering optimizing the view setup. Currently, there are two routes (/list and /details) which each repeat similar views such as the header and sidebar. I'd love to find a more efficient way to handle these repetitive elements within my routes.