AngularJs练习Demo11引入Jquery

寻技术 JS脚本 / JQuery 2023年07月11日 125
 @{
     Layout = null;
 }
 
 <!DOCTYPE html>
 
 <html>
 <head>
     <meta name="viewport" content="width=device-width" />
     <title>ngJquery</title>
     <script type="text/javascript" src="~/Scripts/jquery-1.10.2.js"></script>
     <script type="text/javascript" src="~/Scripts/angular.js"></script>
 
 </head>
 <body>
     <h1>Angular使用Jquery</h1>
     <div ng-app="myApp">
         <div ng-controller="firstController">
             <div ></div>
             {{name}}
         </div>
         <div ng-controller="secondController">
 
         </div>
         <div ng-controller="threeController">
 
         </div>
     </div>
 <script type="text/javascript">
     var app = angular.module("myApp",[]);
     app.controller("firstController", function ($scope) {
         $scope.name = "张三";
        // $("#obj1").html("<span>111111111111</span>");
 
         var obj1 = document.getElementById("obj1");
         angular.element(obj1).html("<span>这是AngularJS 内置的jqlite</span>");//不引入jq的情况下可以使用jqlite,但是功能比jq少。详情参考jqlite的文档
     });
 </script>
 </body>
 
 </html>

 

关闭

用微信“扫一扫”