angular-autoselect
v0.3.3
Published
AngularJS directive(s) to automatically select text within input fields
Downloads
57
Maintainers
Readme
angular-autoselect
AngularJS directive(s) to automatically select text within input fields.
Demo
Usage
Include this module:
angular.module('myModule', ['badwing.autoselect']);
Use the autoSelect
directive:
<input type="text" ng-model="foo" auto-select="options"/>
Where options
is an object with the following properties:
- once
{boolean}
: If true, only auto-select once. Defaultfalse
. - start
{number}
: If set, begin the selection at this index within the input field's value. Default0
. - end
{number}
: If set, end the selection at this index within the input field's value. Default is the length of the value. - match
{(string|RegExp)}
: If astring
, select only the substring, if present. If aRegExp
, then select all the text matched by the regular expression. If the directive cannot find the substring or the regular expression, it will not attempt to select text.
The autoSelect
directive requires the ngModel
directive.
Note: Not all input fields are supported by all browsers. Read about support.
Installation
$ npm install angular-autoselect
or
$ bower install angular-autoselect
angular-autoselect is a UMD module.
Author
License
MIT