0.0.3 • Published 7 years ago

ng-autofocus-directive v0.0.3

Weekly downloads
21
License
MIT
Repository
github
Last release
7 years ago

ng-autofocus-directive

This directive solves the issue of autofocus in angular 2.x, inclusive when you use a dinamically input created before the DOM generation, for example an input created using *ngIf or a hidden input.

Build Status Dependency Status devDependency Status npm

Install

You can get it on npm:

npm install ng-autofocus-directive --save

Setup

You'll need to add AutofocusModule to your application module.

import { AutofocusModule } from 'ng-autofocus-directive';

    @NgModule({
      imports: [
        AutofocusModule
      ],
      declarations: [
        AppComponent
      ],
      providers: [],
      bootstrap: [AppComponent]

      export class AppModule {}
})

Usage

Use the directive in your input:

<input ngAutoFocus type="text">