JSFiddle - React, Tailwind, and code Playground

by santoshpatro

HTML

<div ng-app="" ng-controller="CalculatorController">First Number:
    <input type="text" ng-model="firstNumber" />
    <br/>
    Second Number:<input type="text" ng-model="secondNumber" />
    <button ng-click="sum()">Sum</button>
     <h2>Calculator</h2>

    <div>{{ finalValue }}</div>
</div>

JavaScript

function CalculatorController($scope) {
    
    $scope.sum = function () {
        $scope.finalValue = parseInt($scope.firstNumber) + parseInt($scope.secondNumber);
        $scope.firstNumber = "";
        $scope.secondNumber = "";
    };
}