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

Method constructor

src/material/select/select.ts:593–627  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

591 @Output() readonly valueChange: EventEmitter<any> = new EventEmitter<any>();
592
593 constructor() {
594 const defaultErrorStateMatcher = inject(ErrorStateMatcher);
595 const parentForm = inject(NgForm, {optional: true});
596 const parentFormGroup = inject(FormGroupDirective, {optional: true});
597 const tabIndex = inject(new HostAttributeToken('tabindex'), {optional: true});
598 const defaultPopoverConfig = inject(OVERLAY_DEFAULT_CONFIG, {optional: true});
599 const formField = inject(FORM_FIELD, {optional: true, self: true});
600
601 if (this.ngControl) {
602 // Note: we provide the value accessor through here, instead of
603 // the `providers` to avoid running into a circular import.
604 this.ngControl.valueAccessor = this;
605 }
606
607 // Note that we only want to set this when the defaults pass it in, otherwise it should
608 // stay as `undefined` so that it falls back to the default in the key manager.
609 if (this._defaultOptions?.typeaheadDebounceInterval != null) {
610 this.typeaheadDebounceInterval = this._defaultOptions.typeaheadDebounceInterval;
611 }
612
613 this._errorStateTracker = new _ErrorStateTracker(
614 defaultErrorStateMatcher,
615 formField || this.ngControl,
616 parentFormGroup,
617 parentForm,
618 this.stateChanges,
619 );
620
621 this._scrollStrategy = this._scrollStrategyFactory();
622 this.tabIndex = tabIndex == null ? 0 : parseInt(tabIndex) || 0;
623 this._popoverLocation = defaultPopoverConfig?.usePopover === false ? null : 'inline';
624
625 // Force setter to be called in case id was not specified.
626 this.id = this.id;
627 }
628
629 ngOnInit() {
630 this._selectionModel = new SelectionModel<MatOption>(this.multiple);

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected