Add angular-route
This commit is contained in:
parent
a059014b1b
commit
5466ce78f0
9 changed files with 1071 additions and 25 deletions
|
@ -39,20 +39,13 @@
|
|||
<!-- Left Menu -->
|
||||
<div ng-include="'./partials/menu.html'"></div>
|
||||
</div>
|
||||
<div class="col-lg-10" ng-controller="mainCtrl">
|
||||
<div class="col-lg-10">
|
||||
<div class="container-lg" >
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading">
|
||||
{{ test }}
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
Main Content
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div ng-view></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -69,8 +62,10 @@
|
|||
<script src="./vendors/bootstrap/js/bootstrap.min.js"></script>
|
||||
<!-- Include AngularJS and dependencies-->
|
||||
<script src="./vendors/angularjs/angular.min.js"></script>
|
||||
<script src="./vendors/angularjs/angular-route.js"></script>
|
||||
<script src="./js/app.js"></script>
|
||||
<script src="./js/controllers/main.js"></script>
|
||||
<script src="./js/controllers/home.js"></script>
|
||||
<script src="./js/controllers/network.js"></script>
|
||||
<script src="./js/controllers/status.js"></script>
|
||||
|
||||
|
||||
|
|
|
@ -1,3 +1,18 @@
|
|||
|
||||
// Declare main app
|
||||
var mainApp=angular.module("mainApp",[]);
|
||||
var mainApp=angular.module("mainApp",['ngRoute']);
|
||||
|
||||
|
||||
mainApp.config(['$routeProvider', function($routeProvider){
|
||||
$routeProvider.
|
||||
when('/home',{
|
||||
templateUrl: 'partials/home.html',
|
||||
controller: 'homeCtrl'
|
||||
}).
|
||||
when('/network',{
|
||||
templateUrl: 'partials/network.html',
|
||||
controller: 'networkCtrl'
|
||||
}).otherwise({
|
||||
redirectTo: '/home'
|
||||
});
|
||||
}]);
|
10
client/js/controllers/home.js
Normal file
10
client/js/controllers/home.js
Normal file
|
@ -0,0 +1,10 @@
|
|||
/*
|
||||
* home Controller
|
||||
*/
|
||||
|
||||
|
||||
|
||||
mainApp.controller('homeCtrl', function ($scope)
|
||||
{
|
||||
$scope.test="Home view";
|
||||
});
|
|
@ -1,10 +0,0 @@
|
|||
/*
|
||||
* mainApp Controller
|
||||
*/
|
||||
|
||||
|
||||
|
||||
mainApp.controller('mainCtrl', function ($scope)
|
||||
{
|
||||
$scope.test="Test title";
|
||||
});
|
10
client/js/controllers/network.js
Normal file
10
client/js/controllers/network.js
Normal file
|
@ -0,0 +1,10 @@
|
|||
/*
|
||||
* network Controller
|
||||
*/
|
||||
|
||||
|
||||
|
||||
mainApp.controller('networkCtrl', function ($scope)
|
||||
{
|
||||
$scope.test="Network View";
|
||||
});
|
9
client/partials/home.html
Normal file
9
client/partials/home.html
Normal file
|
@ -0,0 +1,9 @@
|
|||
<div class="panel panel-default">
|
||||
<div class="panel-heading">
|
||||
{{ test }}
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
Main Content
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
|
@ -1,4 +1,4 @@
|
|||
<div class="list-group">
|
||||
<button type="button" class="list-group-item">Home</button>
|
||||
<button type="button" class="list-group-item">Network</button>
|
||||
<a href="#/home" class="list-group-item">Home</a>
|
||||
<a href="#/network" class="list-group-item">Network</a>
|
||||
</div>
|
9
client/partials/network.html
Normal file
9
client/partials/network.html
Normal file
|
@ -0,0 +1,9 @@
|
|||
<div class="panel panel-default">
|
||||
<div class="panel-heading">
|
||||
{{ test }}
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
Main Content
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
1008
client/vendors/angularjs/angular-route.js
vendored
Normal file
1008
client/vendors/angularjs/angular-route.js
vendored
Normal file
File diff suppressed because it is too large
Load diff
Loading…
Add table
Reference in a new issue