您的位置:首页 > Web前端 > AngularJS

AngularJs练习Demo16 ngRoute

2016-06-21 23:09 337 查看
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title></title>
<meta charset="utf-8" />
<script src="../Scripts/angular.min.js"></script>
<script src="../Scripts/angular-route.min.js"></script>
</head>
<body>
<div ng-app="myApp">
<div ng-controller="firstController">
{{text}}
</div>
<script type="text/javascript">
var app = angular.module("myApp", ['ngRoute']);
app.config(['$routeProvider', function ($routeProvider) {
$routeProvider.when("/aaa/:num", {
template: '<p>首页的内容</p>{{name}}', //templateUrl
contorller:"Aaa"
}).when("/bbb", {
template: "<p>学员的内容</p>{{name}}",
contorller:"Bbb"
}).when("/ccc", {
template: "test.html",
contorller:"Ccc"
}).otherwise({
redirectTo:"/aaa"
});
}]);
</script>

</div>
</body>
</html>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: