https://github.com/boneskull/angular-autoselect
AngularJS directive(s) to automatically select text within input fields
https://github.com/boneskull/angular-autoselect
Last synced: 2 months ago
JSON representation
AngularJS directive(s) to automatically select text within input fields
- Host: GitHub
- URL: https://github.com/boneskull/angular-autoselect
- Owner: boneskull
- License: mit
- Archived: true
- Created: 2014-09-16T22:12:42.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2017-05-08T18:58:47.000Z (almost 9 years ago)
- Last Synced: 2025-03-10T03:48:50.194Z (11 months ago)
- Language: JavaScript
- Homepage: http://boneskull.github.io/angular-autoselect
- Size: 882 KB
- Stars: 5
- Watchers: 2
- Forks: 2
- Open Issues: 7
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# angular-autoselect
AngularJS directive(s) to automatically select text within input fields.
## [Demo](http://boneskull.github.io/angular-autoselect)
## Usage
Include this module:
```js
angular.module('myModule', ['badwing.autoselect']);
```
Use the `autoSelect` directive:
```html
```
Where `options` is an object with the following properties:
- **once** `{boolean}`: If true, only auto-select once. Default `false`.
- **start** `{number}`: If set, begin the selection at this index within the input field's value. Default `0`.
- **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 a `string`, select only the substring, if present. If a `RegExp`, 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](https://html.spec.whatwg.org/multipage/forms.html#do-not-apply).
## Installation
```shell
$ npm install angular-autoselect
```
or
```shell
$ bower install angular-autoselect
```
**angular-autoselect** is a [UMD](https://github.com/umdjs/umd) module.
## Author
[Christopher Hiller](http://boneskull.github.io)
## License
MIT