angular-focus-it

AngularJS module to focus an HTML input element.

Module License: MIT

Added by: Sam Deering

GitHub

Repository

hewerthomn/angular-focus-it

Stats

Stars: 3

Watchers: 3

Forks: 0

Module Description

Angular FocusIt module

AngularJS module to focus an HTML input element.

Installation

Run the bower's install command or download this repository.

bower install angular-focus-it

Include the angular-focus-it.min.js file.

<script src="bower_components/angular-focus-it/angular-focus-it.min.js"></script>

Configuration

Add the focusIt module in your app dependencies.

angular.module('app', [

    'focusIt'

])

Usage

To use in your controller, add focus in your controller dependencies.

.controller('HomeCtrl', ['$scope', 'focus', function($scope, focus) {
    focus('name');

    var timeout = 500; // milliseconds, 1000 ms = 1 second
    focus('type', timeout); // param timeout is optional e has default value = 0
}]);

Using in the directives:

  • The focus-id attribute to set the id of the target element to focus.
  • The focus-on attribute to set the event name to trigger the focus.
<button type="button" focus-id="age" focus-on="click">Focus age</button>
<button type="button" focus-id="search" focus-on="click" focus-timeout="400">Focus Search</button>

Example

Demo online

License

Angular FocusIt is freely distributable under the terms of the MIT license.

Module stats last updated: 2015-06-04 11:09:23

Disclaimer: Some data on this page may have been gathered from the authors GitHub respository. If you see any mistakes or outdated information please let us know. Thanks!