JSFiddle - React, Tailwind, and code Playground

by Shailesh Vaishampayan

HTML

<body>
    Write some text in textbox:
     <div ng-controller="MyController as mc">
    <input type="text" ng-focus="mc.setFocus('name')" />
    {{mc.allFilled}}
    {{mc.focus}}
    </div>
</body>

JavaScript

var myApp = angular.module('myApp1', []);
angular.element(document).ready(function() {
   angular.bootstrap(document, ['myApp1']);
});
function MyController($scope){
   var mc = this;
     mc.focus = {
        'name' :false,
        'email':false
    };
    
    $scope.$watch(mc.focus,function(oldVal,newVal){
        console.log(oldVal);
        console.log(newVal);
    },false);
    mc.allFilled = false;
    mc.setFocus = function(prop) {
        mc.focus[prop] = true;
    };
};    
myApp.controller("MyController",MyController);