ngOnInit method

  1. @override
void ngOnInit()

Executed after the first change detection run for a directive.

See OnInit for a full description.

Implementation

@override
void ngOnInit() {
  if (!_autoFocus) return;

  if (_modal != null || _popupRef != null) {
    var isVisible = _popupRef != null
        ? _popupRef!.isVisible
        : _modal!.resolvedOverlayRef.isVisible;
    _onModalOrPopupVisibleChanged(isVisible);

    var onVisibleChanged = _popupRef != null
        ? _popupRef!.onVisibleChanged
        : _modal!.resolvedOverlayRef.onVisibleChanged;
    _disposer.addStreamSubscription(
        onVisibleChanged.listen(_onModalOrPopupVisibleChanged));
  } else {
    _domService.scheduleWrite(focus);
  }
}