angularjs 服務供應商

來源:互聯網
上載者:User

標籤:

<!DOCTYPE HTML><html ng-app="myApp"><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><title>無標題文檔</title><style>#parent div{ width:300px; height:500px; border:1px #000 solid; margin:20px;}#parent ul{ width:200px; position:fixed; top:0; right:0;}</style><script src="angular.min.js"></script><script>//供應商:為對應的服務初始化相關配置var m1 = angular.module(‘myApp‘,[]);//interpolateProvider是interpolate(插值)的服務供應商,scopeProvider是scope的服務供應商。供應商的操作要在config裡面寫。m1.config([‘$interpolateProvider‘,function($interpolateProvider){        //不用{{}}用@@@@。    $interpolateProvider.startSymbol(‘@@‘);    $interpolateProvider.endSymbol(‘@@‘);    }]);m1.controller(‘Aaa‘,[‘$scope‘,‘$interpolate‘,function($scope,$interpolate){        $scope.$watch(‘body‘,function(newBody){                if(newBody){            var temp = $interpolate(newBody);            $scope.showText = temp({ name : $scope.name });                    }            });    }]);</script></head><body><div ng-controller="Aaa">    <input type="text" ng-model="name">    <textarea ng-model="body">    </textarea>    <p>@@[email protected]@</p></div></body></html>
<!DOCTYPE HTML><html ng-app="myApp"><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><title>無標題文檔</title><style>#parent div{ width:300px; height:500px; border:1px #000 solid; margin:20px;}#parent ul{ width:200px; position:fixed; top:0; right:0;}</style><script src="angular.min.js"></script><script>var m1 = angular.module(‘myApp‘,[]);//$logProvider是$log服務的供應商。m1.config([‘$interpolateProvider‘,‘$logProvider‘,function($interpolateProvider,$logProvider){    $logProvider.debugEnabled(false);//禁用debug,則下面就不能列印hello.}]);m1.controller(‘Aaa‘,[‘$scope‘,‘$log‘,function($scope,$log){    $log.debug(‘hello‘);}]);</script></head><body><div ng-controller="Aaa">   </div></body></html>
<!DOCTYPE HTML><html ng-app="myApp"><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><title>無標題文檔</title><style>#parent div{ width:300px; height:500px; border:1px #000 solid; margin:20px;}#parent ul{ width:200px; position:fixed; top:0; right:0;}</style><script src="angular.min.js"></script><script>var m1 = angular.module(‘myApp‘,[]);//$anchorScrollProvider是anchorScroll的服務供應商,m1.config([‘$anchorScrollProvider‘,function($anchorScrollProvider){    $anchorScrollProvider.disableAutoScrolling();//禁止錨點跳轉。}]);m1.controller(‘Aaa‘,[‘$scope‘,‘$location‘,‘$anchorScroll‘,function($scope,$location,$anchorScroll){    $scope.change = function(id){            $location.hash(id);        $anchorScroll();    };}]);</script></head><body><div id="parent" ng-controller="Aaa">    <ul>        <li ng-repeat="id in [1,2,3,4,5]" ng-click="change(‘div‘+id)">{{id}}aaaaaaaaaa</li>    </ul>    <div ng-repeat="id in [1,2,3,4,5]" ng-attr-id="div{{id}}">{{id}}</div></div></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.