<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="main.css">
<!-- Include the core AngularJS library -->
<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.3.5/angular.min.js"></script>
<!-- Include the AngularJS routing library -->
<script src="https://code.angularjs.org/1.2.28/angular-route.min.js"></script>
</head>
<body ng-app="myApp">
<div ng-view></div>
<script src="app.js"></script>
<script src="HomeController.js"></script>
<script src="DetailsController.js"></script>
</body>
</html>
var app = angular.module('myApp', ['ngRoute']);
app.config(function ($routeProvider) {
$routeProvider
.when('/', {
controller: 'HomeController',
templateUrl: 'homeView.html'
})
.when('/details/:name', {
controller: 'DetailsController',
templateUrl: 'detailsView.html'
})
.otherwise({
redirectTo: '/'
});
});
app.controller('HomeController', ['$scope', function($scope) {
$scope.developers = [
'Jeffrey',
'Billy'
];
}]);
<div ng-repeat="developer in developers">
<a href="#/details/{{ developer }}">
{{ developer }}
</a>
</div>
Name in uppercase: {{ name | uppercase }}<br/>
<a href="#/">back</a>
app.controller('DetailsController', ['$scope', '$routeParams', function($scope, $routeParams) {
$scope.name = $routeParams.name;
}]);