JSFiddle - React, Tailwind, and code Playground

by aleksabl

HTML

<div ng-app="myApp" ng-controller="MyController">
  {{myValue}}
    <input id="myValue" ng-model="myValue" type="text" ng-blur="changeToFooBar()" />
</div>

JavaScript

var myApp = angular.module('myApp',[]);

function MyController($scope) {
    $scope.myValue = 'a';
    
    $scope.changeToFooBar = function() {
        console.log($scope.myValue);        
        $scope.myValue=$scope.myValue + '!!';
        console.log($scope.myValue);
    }
 
}

myApp.directive('ngBlur', function() {
    return function(scope, element, attrs) {
        element.bind('blur', function(){
            console.log('Going blur');            
            scope.$eval(attrs.ngBlur);
        });
    };
});