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

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