<html ng-app="App">
<head>
<meta charset="utf-8" />
<title>路由</title>
<!--没有本地的就获取网络上的 路由包 地址-->
<script src="http://cdn.static.runoob.com/libs/angular.js/1.4.6/angular.min.js"></script>
<!--没有本地的就获取网络上的 angularjs 地址-->
<script src="https://apps.bdimg.com/libs/angular-route/1.3.13/angular-route.js"></script>
<script>
var App = angular.module("App", ["ngRoute"]);
App.config(["$routeProvider", function($routeProvider) {
$routeProvider.when("/aaa1", {
//新建一个html 利用 templateUrl进行引用 网页
templateUrl: "aa.html"
})
.when("/bbb", {
//新建一个html 利用 template 静态网页
template: '<p>个人</p>{{result}}'
})
.when("/ccc", {
template: '<p>我的</p>{{result}}'
})
//设置默认
.otherwise({
redirectTo: '/aaa1'
});
}]);
App.controller("Democtrl", function($scope) {
//$scope.result = "hello World";
//data nihao
//$scope.restult =data;
});
</script>
</head>
<body ng-controller="Democtrl">
<div>
<a href="#/aaa1">首页</a>
<a href="#/bbb">个人</a>
<a href="#/ccc">我的</a>
</div>
<div ng-view></div>
</body>
</html>
<head>
<meta charset="utf-8" />
<title>路由</title>
<!--没有本地的就获取网络上的 路由包 地址-->
<script src="http://cdn.static.runoob.com/libs/angular.js/1.4.6/angular.min.js"></script>
<!--没有本地的就获取网络上的 angularjs 地址-->
<script src="https://apps.bdimg.com/libs/angular-route/1.3.13/angular-route.js"></script>
<script>
var App = angular.module("App", ["ngRoute"]);
App.config(["$routeProvider", function($routeProvider) {
$routeProvider.when("/aaa1", {
//新建一个html 利用 templateUrl进行引用 网页
templateUrl: "aa.html"
})
.when("/bbb", {
//新建一个html 利用 template 静态网页
template: '<p>个人</p>{{result}}'
})
.when("/ccc", {
template: '<p>我的</p>{{result}}'
})
//设置默认
.otherwise({
redirectTo: '/aaa1'
});
}]);
App.controller("Democtrl", function($scope) {
//$scope.result = "hello World";
//data nihao
//$scope.restult =data;
});
</script>
</head>
<body ng-controller="Democtrl">
<div>
<a href="#/aaa1">首页</a>
<a href="#/bbb">个人</a>
<a href="#/ccc">我的</a>
</div>
<div ng-view></div>
</body>
</html>

7702

被折叠的 条评论
为什么被折叠?



