listItems property

  1. @ContentChildren(FocusableItem)
set listItems (List<FocusableItem> listItems)

Implementation

@ContentChildren(FocusableItem)
set listItems(List<FocusableItem> listItems) {
  _children.clear();
  _disposer.dispose();
  listItems.forEach((i) {
    _children.add(i);
    _disposer.addDisposable(i.focusmove.listen(_moveFocus));
  });
  // Since this is updating children that were already dirty-checked,
  // need to delay this change until next angular cycle.
  _ngZone.runAfterChangesObserved(() {
    _children.forEach((c) {
      c.tabbable = false;
    });
    if (_children.isNotEmpty) {
      if (autoFocusIndex != null) {
        focus(autoFocusIndex); // This will also make the item tabbable.
      } else {
        _children.first.tabbable = true;
      }
    }
  });
}