Angular attribute directive that gives focus on an element depending on a given expression.
npm install --save angular2-focus
import {NgModule, Component} from '@angular/core';
import {FocusModule} from 'angular2-focus';
@Component({
template: `
<input type="text" focus="true">
`
})
class AppComponent { }
@NgModule({
imports: [FocusModule.forRoot()],
declarations: [AppComponent],
bootstrap: [AppComponent]
})
export class AppModule { }
Check the docs for examples using @angular/forms
and other third party libraries such as
@ng-bootstrap/ng-bootstrap
, to focus elements when e.g. using a modal.
Thanks goes to these wonderful people (emoji key):
Spyros Ioakeimidis 💬 💻 ⚠️ |
---|
This project follows the all-contributors specification. Contributions of any kind welcome!