Route
Is used for deep linking URLs to Controllers and Views, Define routes using $routeProvider. Typically used in conjunction with ngView directive and $routeParams service.
index.html
<!DOCTYPE html>
<html ng-app='app'>
<head>
<link rel="stylesheet" href="style.css">
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.0/angular.min.js"></script>
<script src="https://rawgit.com/angular/bower-angular-route/master/angular-route.min.js"></script>
<script src="script.js"></script>
</head>
<body>
<div ng-view></div>
</body>
</html>
home.html
<h1>{{title}}</h1>
<p>{{description()}}</p>
<a href="#/info">Go to info page</a>
info.html
<h1>{{title}}</h1>
<a href="#/">Go to home page</a>
app.js
var app = angular.module('app', ['ngRoute'])
.config(['$routeProvider', function($routeProvider) {
$routeProvider.when('/', {
controller: 'HomeCtrl',
templateUrl: './home.html'
});
$routeProvider.when('/info', {
controller: 'InfoCtrl',
templateUrl: './info.html'
});
}])
.controller('HomeCtrl', ['$scope', function($scope) {
$scope.title = 'Welcome to the Home Page';
$scope.description = function() {
return 'This is the home page';
};
}])
.controller('InfoCtrl', ['$scope', function($scope) {
$scope.title = 'Hello you are now in the Information Page';
}]);