Stackoverflow Example Up/Down Vote

by Jeremy Likness

HTML

<div ng-app="myApp" ng-controller="myController">
    <span>
<a ng-click="upCount = upCount + 1" href="#" ng-init="upCount=location.upVoteCount">Up: {{upCount}}</a>
<a ng-click="downCount = downCount - 1" href="#" ng-init="downCount=location.downVoteCount">Down: {{downCount}}</a>
</span>
</div>

JavaScript

var app = angular.module("myApp", []);

app.controller("myController", function($scope) {
    $scope.location = {
        upVoteCount: 0,
        downVoteCount: 0
    };
});