首页 > Web开发 > 详细

AngularJs练习Demo10 ngInclude

时间:2016-06-22 00:18:20      阅读:229      评论:0      收藏:0      [点我收藏+]
 1 @{
 2     Layout = null;
 3 }
 4 
 5 <!DOCTYPE html>
 6 
 7 <html>
 8 <head>
 9     <meta name="viewport" content="width=device-width" />
10     <title>ngInclude</title>
11     <script src="~/Scripts/angular.js"></script>
12 
13 </head>
14 <body>
15     <div ng-app="myApp">
16         <script type="text/ng-template" id="tpl.html">
17             @*AngularJS定义模板必须放在ng-app内*@
18             Content of the template
19         </script>
20         <script type="text/ng-template" id="tpl2.html">
21             @*AngularJS定义模板必须放在ng-app内*@
22             Content of the template2
23 
24         </script>
25         <div ng-controller="firstController">
26             <div ng-include="url"></div>
27             <div ng-include="tpl"></div>
28             <div ng-include src="tpl2"></div>
29         </div>
30 
31     </div>
32    
33     <script type="text/javascript">
34         var app = angular.module("myApp", []);
35         app.controller("firstController", function ($scope) {
36             $scope.url = "/Angular/ngInclude1";
37             $scope.tpl = "tpl.html";
38             $scope.tpl2 = "tpl2.html";
39         });
40     </script>
41 </body>
42 </html>

 

AngularJs练习Demo10 ngInclude

原文:http://www.cnblogs.com/sumg/p/5605357.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!