Skip to content

igxFocusDirective Specification

Radoslav Karaivanov edited this page Apr 5, 2018 · 2 revisions

Overview

IgxFocus should focus the element it is applied on.

 <input type="text" [igxFocus]="true" />

User Stories

Developer

As a developer I want to be able to force auto focus to any given element whenever it appears into the DOM.

End User

As an end user I would like to focus the element where directive is applied right after it appears into the DOM.

Integration scenarios

Automatically focusing the cell of igxGrid when we are entering into edit mode.

API

Inputs

Name Type Description
igxFocus boolean Determines whether the element should be focusable through the directive.

Accessors

Name Type Description
focused boolean Returns whether the element is focused or not.
nativeElement ElementRef Returns the nativeElement of the element where the directive was applied.

Methods

Name Type Description
trigger void Triggers the focus of the element.

Assumptions and Limitations

The host element for the directive should be focusable - i.e. it should be a native input element or an element with a tabindex attribute set.

Clone this wiki locally