码迷,mamicode.com
首页 > Web开发 > 详细

AngularJS 加与减

时间:2015-08-25 13:45:36      阅读:157      评论:0      收藏:0      [点我收藏+]

标签:

<div ng-controller="MyController">
<button ng-click="Plus()"></button>
<h1>Hello {{ text }}</h1>
<button ng-click="Reduction()"></button>
</div>

<script>
angular.module(‘myApp‘,[])
.controller("MyController",function($scope){
$scope.text = 1 ;
$scope.add = function(){
$scope.text += 1;
};
$scope.subtract = function(){
$scope.text -= 1;
}
})
</script>

AngularJS 加与减

标签:

原文地址:http://www.cnblogs.com/Lin-Edge/p/4757011.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!