javascript
该怎么写Angular JS
<html ng-app>
<head>
??? <title>表單</title>
??? <script type="text/javascript" src="angular.min.js"></script>
??? <script type="text/javascript">
??? function StartUpController($scope) {
??????? $scope.funding = {startingEstimate:0};
??????? computeNeeded = function() {
??????????? $scope.funding.needed = $scope.funding.startingEstimate * 10;
??????? };
??????? $scope.$watch('funding.startingEstimate',computeNeeded);//watch監視一個表達式,當這個表達式發生變化時就會調用一個回調函數
??????? $scope.requestFunding = function() {
??????????? window.alert("Sorry,please get more customers first.")
??????? };
??? }
??? </script>
</head>
<body>
??? <form ng-submit="requestFunding()" ng-controller="StartUpController">? //ng-submit
??????? Starting: <input ng-change="computeNeeded()" ng-model="funding.startingEstimate">
??????? Recommendation: {{funding.needed}}
??????? <button>Fund my startup!</button>
??? </form>
</body>
</html>
轉載于:https://www.cnblogs.com/ruimeng/p/4696706.html
總結
以上是生活随笔為你收集整理的该怎么写Angular JS的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 怎么把pdf文件转换成可编辑的word文
- 下一篇: darwin转发时,摄像机在3G和4G模