您好,登錄后才能下訂單哦!
<!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>
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。