html:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<style type="text/css" media="screen">
ul{margin-bottom: 100px;}
ul li{
float: left;
list-style: none;
width: 50px;
text-align: center;
}
</style>
</head>
<body ng-app='routingDemoApp'>
<h2>AngularJS应用</h2>
<ul>
<li><a href="#/">首页</a></li>
<li><a href="#/computer">电脑</a></li>
<li><a href="#/printers">打印机</a></li>
<li><a href="#/others">其他</a></li>
</ul>
<div ng-view></div>
<script src="https://cdn.static.runoob.com/libs/angular.js/1.4.6/angular.min.js"></script>
<script src="https://apps.bdimg.com/libs/angular-route/1.3.13/angular-route.js"></script>
<script>
var aa=angular.module('routingDemoApp',['ngRoute'])
aa.config(['$routeProvider', function($routeProvider){
$routeProvider.when('/',{
templateUrl:'shouye.html'
}).when('/computer',{
template:'这是电脑页面'
}).when('/printers',{template:'<h2>这是打印页面</h2>'
}).otherwise({
redirectTo:'/'
})
}]);
</script>
</body>
</html>
shouye.html
<h1>这是首页</h1>