AngularJs练习Demo11引入Jquery

 1 @{
 2     Layout = null;
 3 }
 4 
 5 <!DOCTYPE html>
 6 
 7 <html>
 8 <head>
 9     <meta name="viewport" content="width=device-width" />
10     <title>ngJquery</title>
11     <script type="text/javascript" src="~/Scripts/jquery-1.10.2.js"></script>
12     <script type="text/javascript" src="~/Scripts/angular.js"></script>
13 
14 </head>
15 <body>
16     <h1>Angular使用Jquery</h1>
17     <div ng-app="myApp">
18         <div ng-controller="firstController">
19             <div id="obj1"></div>
20             {{name}}
21         </div>
22         <div ng-controller="secondController">
23 
24         </div>
25         <div ng-controller="threeController">
26 
27         </div>
28     </div>
29 <script type="text/javascript">
30     var app = angular.module("myApp",[]);
31     app.controller("firstController", function ($scope) {
32         $scope.name = "张三";
33        // $("#obj1").html("<span>111111111111</span>");
34 
35         var obj1 = document.getElementById("obj1");
36         angular.element(obj1).html("<span>这是AngularJS 内置的jqlite</span>");//不引入jq的情况下可以使用jqlite,但是功能比jq少。详情参考jqlite的文档
37     });
38 </script>
39 </body>
40 
41 </html>

 

posted @ 2016-06-21 23:05  编程猴子  阅读(2157)  评论(0编辑  收藏  举报