JSFiddle - React, Tailwind, and code Playground

by Alan Doe

HTML

<div id="startStuf" ng-app , ng-controller="startController">
    <form ng-submit="submitForm()" >
        <input type="text" ng-change="calculateVal()" ng-model="foo.bar"></input>
        <button>click to submit</button>
    </form>
    
</div>

JavaScript

function startController($scope)
{
    $scope.foo = {bar : 0};
    
    $scope.calculateVal = function()
    {
        alert('called calc');
        $scope.foo.bar = foo.bar + "a1";
    }
    
    handleChange = function()
    {
        alert('handle change');
    }
    
    $scope.$watch('foo.bar', handleChange);

}