ng-autofocus

AngularJS autofocus directive
Homepage:
1 person uses it
Author: 4262078?v=3 hiebj

https://www.npmjs.com/package/ng-autofocus

ng-autofocus

A simple attribute directive that will trigger focus on an element under specified conditions.

It is available through NPM:

npm install ng-autofocus

Usage

Include autofocus.min.js in your build or directly with a <script> tag and require the module in your module definition:

angular.module('App', [ 'autofocus', /* other dependencies */ ]);

To immediately focus an element upon rendering:

<input autofocus />

To focus an element when a specified conditional $scope property becomes truthy:

<input autofocus="focusInput" />

To focus an element after a specified delay upon rendering:

<input autofocus autofocus-delay="500" />

To focus an element after a specified delay when a specified conditional $scope property becomes truthy:

<input autofocus="focusInput" autofocus-delay="500" />

comments powered by Disqus
This page was last updated almost 3 years ago.