Add angular-route

This commit is contained in:
manzerbredes 2016-01-24 19:19:32 +01:00
parent a059014b1b
commit 5466ce78f0
9 changed files with 1071 additions and 25 deletions

View file

@ -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>

View file

@ -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'
});
}]);

View file

@ -0,0 +1,10 @@
/*
* home Controller
*/
mainApp.controller('homeCtrl', function ($scope)
{
$scope.test="Home view";
});

View file

@ -1,10 +0,0 @@
/*
* mainApp Controller
*/
mainApp.controller('mainCtrl', function ($scope)
{
$scope.test="Test title";
});

View file

@ -0,0 +1,10 @@
/*
* network Controller
*/
mainApp.controller('networkCtrl', function ($scope)
{
$scope.test="Network View";
});

View 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>

View file

@ -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>

View 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

File diff suppressed because it is too large Load diff