JSFiddle - React, Tailwind, and code Playground

HTML

<div ng-app ng-controller="InputCtrl">
    <input type="number" ng-model="mynum1" format><br>
    <input type="text" ng-model="mynum2" pattern="[0-9]+([\.,][0-9]+)*" format><br>
</div>

JavaScript

angular.module('test', []).directive('format', function ($filter) {
        'use strict';

        return {
            require: '?ngModel',
            link: function (scope, elem, attrs, ctrl) {
                if (!ctrl) {
                    return;
                }

                ctrl.$formatters.unshift(function () {
                    return $filter('number')(ctrl.$modelValue);
                });

                ctrl.$parsers.unshift(function (viewValue) {
                    var plainNumber = viewValue.replace(/[\,\.]/g, ''),
                        b = $filter('number')(plainNumber);

                    elem.val(b);

                    return plainNumber;
                });
            }
        };
    }).controller('InputCtrl', function($scope) {

    $scope.mynum1 = 50000000;
    $scope.mynum2 = 50000000;
});