AngularJs练习Demo11引入Jquery

Posted 编程猴子

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了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>

 

以上是关于AngularJs练习Demo11引入Jquery的主要内容,如果未能解决你的问题,请参考以下文章

AngularJs练习Demo4

AngularJs练习Demo2

AngularJs练习Demo19 Resource

AngularJs练习Demo12Provider

AngularJs练习Demo10 ngInclude

AngularJs练习Demo18 Resource