Sets/gets the id
of the item.
<igx-drop-down-item [id] = 'igx-drop-down-item-0'></igx-drop-down-item>
let itemId = this.item.id;
Sets/gets if the given item is header
// get
let mySelectedItem = this.dropdown.selectedItem;
let isMyItemHeader = mySelectedItem.isHeader;
<!--set-->
<igx-drop-down-item *ngFor="let item of items">
<div *ngIf="items.indexOf(item) === 5; then item.isHeader = true">
{{item.field}}
</div>
</igx-drop-down-item>
Gets/sets the role
attribute of the item. Default is 'option'.
<igx-drop-down-item [role]="customRole"></igx-drop-down-item>
Gets/sets the value of the item if the item is databound
// usage in IgxDropDownItemComponent
// get
let mySelectedItemValue = this.dropdown.selectedItem.value;
// set
let mySelectedItem = this.dropdown.selectedItem;
mySelectedItem.value = { id: 123, name: 'Example Name' }
// usage in IgxComboItemComponent
// get
let myComboItemValue = this.combo.items[0].value;
Sets/gets if the given item is disabled
// get
let mySelectedItem = this.dropdown.selectedItem;
let myItemIsDisabled = mySelectedItem.disabled;
<igx-drop-down-item *ngFor="let item of items" disabled={{!item.disabled}}>
<div>
{{item.field}}
</div>
</igx-drop-down-item>
NOTE: Drop-down items inside of a disabled IgxDropDownGroup
will always count as disabled
Sets/gets if the given item is focused
let mySelectedItem = this.dropdown.selectedItem;
let isMyItemFocused = mySelectedItem.focused;
Sets/gets if the given item is focused
let mySelectedItem = this.dropdown.selectedItem;
let isMyItemFocused = mySelectedItem.focused;
The data index of the dropdown item.
// get the data index of the selected dropdown item
let selectedItemIndex = this.dropdown.selectedItem.index
Sets/Gets if the item is the currently selected one in the dropdown
let mySelectedItem = this.dropdown.selectedItem;
let isMyItemSelected = mySelectedItem.selected; // true
Two-way data binding
<igx-drop-down-item [(selected)]='model.isSelected'></igx-drop-down-item>
Sets/Gets if the item is the currently selected one in the dropdown
The
<igx-drop-down-item>
is a container intended for row items in a<igx-drop-down>
container.