JSFiddle - React, Tailwind, and code Playground

HTML

<body ng-app="MyApp">
    <div ng-controller="MyCtrl">
        <form>
            <input type="text" ng-blur="select()" value="{{txt}}">
            <button>Press</button>
        </form>
    </div>
</body>

CSS

</style> <script src="//ajax.googleapis.com/ajax/libs/angularjs/1.4.7/angular.js"></script>

JavaScript

angular.module('MyApp', []).controller('MyCtrl', function ($scope, $interval) {
   
    $scope.select = function () {    
        document.querySelector("input").setSelectionRange(0, 4);
    }
});