Ng-include 例子

<body>
    <div ng-app="myApp">
       <div ng-controller="firstController">
        <div ng-bind="text"></div>
        <div ng-include="url"></div>
        <div ng-include="tpl"></div>
       </div>
        <script type="text/ng-template" id="tpl.html">
            Content of the template

        </script>
    </div>
    <script type="text/javascript">
        var app = angular.module("myApp", []);

        app.controller('firstController', ['$scope', function ($scope) {
          
            $scope.text = "Demo";
            // ng-include 用法
            $scope.url = "/Demo/Other";

            $scope.tpl = "tpl.html";       
        }]);
         
    </script>

</body>

 

posted @ 2016-04-04 22:52  MrMrCash  阅读(482)  评论(0编辑  收藏  举报