We can select content of HTML element using element.select(). But onmouseup action the selected text by script will be deselected. So we have to disable onmouseup action.

Markup

<input ng-focus="selectAllContent($event)" ng-mouseup="$event.preventDefault();" value="sample value"/>

Script

function myCtrl($scope) {
    $scope.selectAllContent= function($event) {
       $event.target.select();
    };
}

0 comments:

Blogroll

Follow this blog by Email

Popular Posts