Add numbers using function call



examples/angular/add_numbers_function.html
<script src="angular.min.js"></script>
<script src="add_numbers_function.js"></script>
<div ng-app="AddNumbersApp">
    <div ng-controller="AddNumbersController">
        <input ng-model="a">
        <input ng-model="b">
        <h1>{{ AddNumbers() }}</h1>
    </div>
</div>

examples/angular/add_numbers_function.js
angular.module('AddNumbersApp', [])
    .controller('AddNumbersController', ['$scope', function($scope) {
        $scope.AddNumbers = function() {
            var a = Number($scope.a || 0);
            var b = Number($scope.b || 0);
            return a+b;
        }
}]);