MCPcopy Create free account
hub / github.com/angular/components / _setActiveOption

Method _setActiveOption

src/material/list/selection-list.ts:465–476  ·  view source on GitHub ↗

* Sets an option as active. * @param index Index of the active option. If set to -1, no option will be active.

(index: number)

Source from the content-addressed store, hash-verified

463 * @param index Index of the active option. If set to -1, no option will be active.
464 */
465 private _setActiveOption(index: number) {
466 this._items.forEach((item, itemIndex) => {
467 let tabindex = -1;
468
469 if (!this.disabled && itemIndex === index) {
470 tabindex = 0;
471 }
472
473 item._setTabindex(tabindex);
474 });
475 this._keyManager.updateActiveItem(index);
476 }
477
478 /**
479 * Resets the active option. When the list is disabled, remove all options from to the tab order.

Callers 3

MatSelectionListClass · 0.95
_setupRovingTabindexMethod · 0.95
_resetActiveOptionMethod · 0.95

Calls 2

_setTabindexMethod · 0.80
updateActiveItemMethod · 0.80

Tested by

no test coverage detected