JSFiddle - React, Tailwind, and code Playground

HTML

<body ng-app="MyApp">
    <div ng-controller="MyCtrl">
        <form>
            <input type="text" value="{{txt}}">
            <button ng-click="select()">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.txt = "Hello World";
    $scope.select = function () {
        $scope.txt = "Bye World";
        // doesn't work
        document.querySelector("input").setSelectionRange(0, 4);
        // works
        $interval(function () {
            document.querySelector("input").setSelectionRange(0, 4);
        }, 10, 1);
    }
});