JSFiddle - React, Tailwind, and code Playground

by Bruno Sabetta

HTML

<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.5.6/angular.min.js"></script>
<div ng-app="myApp" ng-controller="MainCtrl">
  <div ng-model="myInputValue" amount-input-currency></div>
  {{myInputValue}}
</div>

JavaScript

var app = angular.module("myApp", []);
app.controller('MainCtrl', mainCtrl);
app.directive('amountInputCurrency', amountInputCurrency);

mainCtrl.$inject = ['$scope'];
function mainCtrl($scope) {

}



function amountInputCurrency() {
  return {
    require: 'ngModel',
    restrict: 'A',
    scope: {
      myInputValue = "="
    },
    template: '<input type="text" ng-model="myInputValue">',
    link: function(scope, elem, attrs, model) {
      // ...
    }
  }
}