<!doctype html> <html ng-app="myApp"> <head> <title>TEST</title> <script src="angular.js"></script> <script src="sample.js"></script> </head> <body> <div ng-controller="my as mc"> {{mc.count}} <button ng-click="mc.inc()">+1</button> <button ng-click="mc.dec()">-1</button> </div> </body> </html> var app = angular.module("myApp", []); app.controller('my', function() { this.count = 0; this.inc = function() { this.count++; } this.dec = function() { this.count--; } });