angularjs 標籤指令

來源:互聯網
上載者:User

標籤:

<!DOCTYPE HTML><html ng-app="myApp"><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><title>無標題文檔</title><style>.active1{ background:red;}.active2{ background:blue;}</style><script src="angular.min.js"></script><script>var m1 = angular.module(‘myApp‘,[]);m1.controller(‘Aaa‘,[‘$scope‘,function($scope){    $scope.dataList = [        ‘aaaaa‘ , ‘bbbbb‘ , ‘cccccc‘ , ‘dddddd‘ , ‘eeeeee‘    ];}]);</script></head><body><div ng-controller="Aaa">    <input type="checkbox" ng-model="aaa">   //checkbox選中則aaa為true    <select>        <option>11111</option>        <option ng-selected="aaa">22222</option>   //下拉選擇框是否選擇取決於aaa變數    </select>    //輸入框變化就會出發輸入框的值為hello    <input type="text" ng-change="bbb=‘hello‘" ng-model="bbb">{{bbb}}<br>    //ng-paste="ccc=true"當輸入框複製操作時時ccc=true,    <input type="text" value="aasdassssssss" ng-paste="ccc=true">{{ccc}}</div></body></html>
<!DOCTYPE HTML><html ng-app="myApp"><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><title>無標題文檔</title><script src="angular.min.js"></script><script>var m1 = angular.module(‘myApp‘,[]);m1.controller(‘Aaa‘,[‘$scope‘,‘$interval‘,function($scope,$interval){    var iNow = 5;    $scope.text = iNow+‘秒‘;    $scope.isDisabled = true;    //setInterval -> $scope.$apply()    //$timeout   $interval    var timer = $interval(function(){        iNow--;        $scope.text = iNow+‘秒‘;                if(iNow == 0){            $interval.cancel(timer);            $scope.text = ‘可以點擊啦‘;            $scope.isDisabled = false;        }    },1000);}]);</script></head><body><div ng-controller="Aaa">    //ng-disabled="isDisabled",isDisabled是變數名    <input type="button" ng-value="text" ng-disabled="isDisabled">    <input type="text" value="{{text}}" ng-readonly="isDisabled">    <input type="checkbox" value="{{text}}" ng-checked="isDisabled"></div><script>alert(1);</script></body></html>
<!DOCTYPE HTML><html ng-app="myApp"><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><title>無標題文檔</title><script src="angular.min.js"></script>//引入外掛程式,ngSanitize模組<script src="http://cdn.bootcss.com/angular.js/1.3.0-beta.13/angular-sanitize.min.js"></script><script>var m1 = angular.module(‘myApp‘,[‘ngSanitize‘]);  //[‘ngSanitize‘]是引入ngSanitize模組m1.controller(‘Aaa‘,[‘$scope‘,function($scope){    $scope.text = ‘<h1>hello</h1>‘;}]);</script></head><body><div ng-controller="Aaa">    <div ng-bind="text"></div>  //跟ng-value和寫運算式是一樣的    <div ng-bind-template="{{text}},{{text}}"></div>  //ng-bind-template用於寫多個運算式    <div ng-bind-html="text"></div>   //解析html內容,要引入ngSanitize模組    <div ng-cloak>{{text}}</div> //ng-cloak用於沒有解析完畢時不顯示解析完畢後解析,使用者體驗好。    <div ng-non-bindable>{{text}}</div> //原樣輸出,不進行解析。</div><script>alert(1);  //阻止後面的js的執行</script></body></html>
<!DOCTYPE HTML><html ng-app="myApp"><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><title>無標題文檔</title><style>.red{ background:red;}.yellow{ background:yellow;}</style><script src="angular.min.js"></script><script>var m1 = angular.module(‘myApp‘,[]);m1.controller(‘Aaa‘,[‘$scope‘,function($scope){    $scope.text = ‘hello‘;    $scope.style = "{color:‘red‘,background:‘yellow‘}";    $scope.sClass = "{red:true,yellow:true}";    $scope.url = "http://www.baidu.com";}]);</script></head><body><div ng-controller="Aaa">    <div ng-class="{red:true}">{{text}}</div>  //啟用red樣式    <div ng-class="{red:true,yellow:true}">{{text}}</div> //啟用red和yellow樣式    <div ng-class="{{sClass}}">{{text}}</div>    <div ng-style="{color:‘red‘,background:‘yellow‘}">{{text}}</div>    <div ng-style="{{style}}">{{text}}</div>    <a ng-href="{{url}}">aaaaaaa</a>    <a ng-attr-href="{{url}}" ng-attr-title="{{text}}" ng-attr-class="" ng-attr-style="">aaaaaaa</a></div><script>alert(1);  //阻止後面js的執行</script></body></html>

 

angularjs 標籤指令

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.