<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>test</title>
<script src="js/angular.js"></script>
<script type="application/javascript">
(function(angular) {
'use strict';
angular.module('myApp', [])
.controller('firstController', function firstController($scope) {
$scope.page="test.html";
$scope.page2 = "page2.html";
});
})(window.angular);//主模块
window.onload = function(){
var myAppdiv = document.getElementById('myApp22');
angular.bootstrap(myAppdiv,['myApp']) //动态的绑定主mudule的html作用范围
}
</script>
</head>
<body >
<div id="myApp22">
<div ng-controller="firstController">
<div ng-include="page"> <!--把一个页面包涵进来 作为这个div中的子标签-->
</div>
<div ng-include="page2"></div><!--也可以把同域下的script中定义的模板引进来-->
<div ng-include src="page2"></div>
</div>
<script type="text/ng-template" id="page2.html">
hehehehehe
</script>
</div>
</body>
</html>