Cordova學習筆記 ng-include標籤的使用

<!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>


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章