<!doctype html>
<html ng-app="myApp">
<head>
<title>TEST</title>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.4/angular.min.js"></script>
<script>
var app = angular.module("myApp", []);
app.controller('myController', function() {
this.count = 0;
this.inc = function() { this.count++; }
this.dec = function() { this.count--; }
});
</script>
</head>
<body>
<div ng-controller="myController as myCtrl">
{{myCtrl.count}}
<button ng-click="myCtrl.inc()">+1</button>
<button ng-click="myCtrl.dec()">-1</button>
</div>
</body>
</html>
|