<html ng-app='routingDemoApp'>
<head>
<title>UI Router Demo App - Multiple,Nested States & Views</title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" />
</head>
<body class="container">
<h3>AngularJS UI Router Application</h3>
<nav class="navbar navbar-default row">
<div class="container-fluid">
<div class="navbar-header">
<ul class="nav navbar-nav">
<li><a ui-sref="business">Business</a></li>
<li><a ui-sref="portfolio">Portfolio</a></li>
</ul>
</div>
</div>
</nav>
<div class="row">
<div class="span12">
<div class="well" ui-view></div>
</div>
</div>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.4/angular.js"></script>
<script src="https://angular-ui.github.io/ui-router/release/angular-ui-router.js"></script>
<script src="src/modules/business/business.mod.js"></script>
<script src="src/modules/portfolio/portfolio.mod.js"></script>
<script src="src/app.js"></script>
</body>
</html>
(function (ng) {
var App = angular.module('routingDemoApp', ['ui.router',
'BusinessModule',
'PortfolioModule']);
})(window.angular);
/* Styles go here */
<h4>Business page</h4>
<hr/>
<strong>This page shows Nested states & views. Click on below links to see Nested states in action.</strong>
<ul>
<li><a ui-sref=".products">Show Products</a></li>
<li><a ui-sref=".services">Show Services</a></li>
</ul>
<div class="panel panel-default" ui-view></div>
<h4>List of Clients</h4>
<ul>
<li ng-repeat="client in clients">{{client}}</li>
</ul>
<h4>Portfolio Page</h4>
<hr/>
<strong>This page shows multiple named views in action.</strong>
<div class="row">
<div class="col-sm-6">
<div class="panel panel-default" ui-view="view1"></div>
</div>
<div class="col-sm-6">
<div class="panel panel-default" ui-view="view2"></div>
</div>
</div>
<h4>List of Products</h4>
<ul>
<li ng-repeat="product in products">{{product}}</li>
</ul>
<h4>List of Services</h4>
<ul>
<li ng-repeat="srv in services">{{srv}}</li>
</ul>
(function (ng) {
var mod = angular.module('PortfolioModule', ['ui.router']);
mod.config(['$stateProvider', '$urlRouterProvider', function ($stateProvider, $urlRouterProvider) {
var basePath = 'src/modules/portfolio/';
$urlRouterProvider.otherwise("/portfolio");
$stateProvider
.state('portfolio', {
url: "/portfolio",
views: {
"": {templateUrl: basePath+"portfolio.html"},
"view1@portfolio": {template: "Write whatever you want, it's your virtual company."},
"view2@portfolio": {templateUrl: basePath+"clients.html",
controller: function ($scope) {
$scope.clients = ["HP", "IBM", "MicroSoft"];
}
}
}
});
}]);
})(window.angular);
(function (ng) {
var mod = angular.module('BusinessModule', ['ui.router']);
mod.config(['$stateProvider', '$urlRouterProvider', function ($stateProvider, $urlRouterProvider) {
var basePath = 'src/modules/business/';
$urlRouterProvider.otherwise("/business");
$stateProvider
.state('business', {
url: "/business",
templateUrl: basePath+"business.html"
})
.state('business.products', {
url: "/products",
templateUrl: basePath+"products.html",
controller: function ($scope) {
$scope.products = ["Computer", "Printers", "Phones", "Bags"];
}
})
.state('business.services', {
url: "/services",
templateUrl: basePath+"services.html",
controller: function ($scope) {
$scope.services = ["Selling", "Support", "Delivery", "Reparation"];
}
});
}]);
})(window.angular);