<!doctype html> <html lang="en"> <head> <meta charset="UTF-8"> <title>test</title> <style> .red{ background-color: red; } .black{ background-color: black; } </style> <script src="js/angular.js"></script> <script type="application/javascript"> (function(angular) { 'use strict'; angular.module('myApp', []) .controller('firstController', function firstController($scope,$sce) { $scope.witchColor = {red:true,black:false}; $scope.changeColor = function(){ if($scope.witchColor.red){ $scope.witchColor.red = false; }else{ $scope.witchColor.red = true; } if($scope.witchColor.black){ $scope.witchColor.black = false; }else{ $scope.witchColor.black = true; } } $scope.teststyle={color:'yellow'}; $scope.address= "http://www.baidu.com"; $scope.idshow = true; $scope.idshow = false; $scope.mySwitch = 3; $scope.t1 = "test1"; $scope.t2 = "test2"; $sce.trustAsHtml("<a ); $scope.myhtml1= $sce.trustAsHtml("<a );//$sce 中的trustAsHtml來信任這個html內容 }); })(window.angular);//主模塊 window.onload = function(){ var myAppdiv = document.getElementById('myApp22'); angular.bootstrap(myAppdiv,['myApp']) //動態的綁定主mudule的html作用范圍 } </script> </head> <body > <div id="myApp22"> <div ng-controller="firstController"> <div ng-class="witchColor">test</div> <input type="button" value="changeColor" ng-click="changeColor()"/> <div ng->test</div> <a ng-href="`address`">www</a> <div ng-show="idshow">您</div> <div ng-switch on="mySwitch"> <span ng-switch-default> 0</span> <span ng-switch-when="1">1</span> <span ng-switch-when="2">2</span> <span ng-switch-when="3">3</span> </div> <div ng-bind-template="`t1``t2`"></div><!--綁定多個--> <div ng-bind-html="myhtml1" >1212</div> <!--把這個div中的innerHtml綁定到變量myhtml--> </div> </div> </body> </html>
另外有需要云服務器可以了解下創新互聯scvps.cn,海內外云服務器15元起步,三天無理由+7*72小時售后在線,公司持有idc許可證,提供“云服務器、裸金屬服務器、高防服務器、香港服務器、美國服務器、虛擬主機、免備案服務器”等云主機租用服務以及企業上云的綜合解決方案,具有“安全穩定、簡單易用、服務可用性高、性價比高”等特點與優勢,專為企業上云打造定制,能夠滿足用戶豐富、多元化的應用場景需求。
分享名稱:Cordova學習筆記angular中一些標簽的使用-創新互聯
分享鏈接:http://m.kartarina.com/article44/cdccee.html
成都網站建設公司_創新互聯,為您提供網站收錄、微信公眾號、品牌網站建設、做網站、網頁設計公司、網站導航
聲明:本網站發布的內容(圖片、視頻和文字)以用戶投稿、用戶轉載內容為主,如果涉及侵權請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網站立場,如需處理請聯系客服。電話:028-86922220;郵箱:631063699@qq.com。內容未經允許不得轉載,或轉載時需注明來源: 創新互聯