<!doctype html>
<html ng-app="myApp">
<head>
<title>TEST</title>
<script src="angular.js"></script>
<script>
var app = angular.module("myApp", []);
app.controller('myController', function() {
this.count = 0;
this.inc = function() {
this.count=this.count+5; }
this.dec = function() {
this.count=this.count-1; }
});
</script>
</head>
<body>
<div ng-controller="myController as ml">
{{ml.count}}
<button ng-click="ml.inc()">+1</button>
<button ng-click="ml.dec()">-1</button>
</div>
</body>
</html>
最終更新:2016年05月24日 22:36