<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title></title>
<style type="text/css">
ul {
list-style: none;
}
ul li {
float: left;
width: 60px;
}
a {
text-decoration: none;
}
</style>
<script type="text/javascript" src="js/angular.min.js"></script>
<script type="text/javascript" src="js/angular-route.js" ></script>
</head>
<body ng-app="MyApp" ng-app="MyCont">
<ul>
<li>
<a href="#/">主页</a>
</li>
<li>
<a href="#/bb">购物车</a>
</li>
<li>
<a href="#/cc">我的</a>
</li>
</ul>
<div ng-view style="background-color: gray;">
</div>
<script>
var mo = angular.module("MyApp", ["ngRoute"]);
mo.controller("MyCont", function($scope) {
})
mo.config(function($routeProvider) {
// $routeProvider.when("/aa", {
// templateUrl: "zhuye.html"
// });
//
// $routeProvider.when("/bb", {
// templateUrl: "goods.html"
// })
//
// $routeProvider.when("/cc", {
// templateUrl: "me.html"
// })
$routeProvider.when("/",{template:"我是主页"}).when("/bb",{templateUrl:"goods.html"}).when("/cc",{templateUrl:"me.html"});
})
</script>
</body>
</html>
<html>
<head>
<meta charset="utf-8" />
<title></title>
<style type="text/css">
ul {
list-style: none;
}
ul li {
float: left;
width: 60px;
}
a {
text-decoration: none;
}
</style>
<script type="text/javascript" src="js/angular.min.js"></script>
<script type="text/javascript" src="js/angular-route.js" ></script>
</head>
<body ng-app="MyApp" ng-app="MyCont">
<ul>
<li>
<a href="#/">主页</a>
</li>
<li>
<a href="#/bb">购物车</a>
</li>
<li>
<a href="#/cc">我的</a>
</li>
</ul>
<div ng-view style="background-color: gray;">
</div>
<script>
var mo = angular.module("MyApp", ["ngRoute"]);
mo.controller("MyCont", function($scope) {
})
mo.config(function($routeProvider) {
// $routeProvider.when("/aa", {
// templateUrl: "zhuye.html"
// });
//
// $routeProvider.when("/bb", {
// templateUrl: "goods.html"
// })
//
// $routeProvider.when("/cc", {
// templateUrl: "me.html"
// })
$routeProvider.when("/",{template:"我是主页"}).when("/bb",{templateUrl:"goods.html"}).when("/cc",{templateUrl:"me.html"});
})
</script>
</body>
</html>