You can use this alternative code
<html>
<body ng-app ng-controller='StudentListController'>
<ul>
<li ng-repeat='student in students'><a href='/student/view/{{student.id}}' class="menu-{{student.valid}}">
{{student.name}} </a>
<input ng-model="student.quantity" ng-change='Sum()' />
</li>
</ul>
<button ng-click="Sum()" class="menu-true">
Sum</button>
<div>
{{sum}}</div>
</body>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/angularjs/1.2.21/angular.min.js"></script>
<script type="text/javascript">
var students = [{ name: 'Mary Contrary', id: '1', valid: 'true', quantity: 0 },
{ name: 'Jack Sprat', id: '2', valid: 'false', quantity: 0 },
{ name: 'Jill Hill', id: '3', valid: 'false', quantity: 0}];
function StudentListController($scope) {
$scope.students = students;
$scope.sum = 0;
$scope.Sum = function () {
$scope.sum = 0;
for (var i = 0; i < $scope.students.length; i++) {
$scope.sum = parseFloat($scope.sum) + parseFloat($scope.students[i].quantity);
}
};
}
</script>
</html>