Skip to content

mat-select throw an error after option selected  #8213

@iceekey

Description

@iceekey

Bug, feature request, or proposal:

index.d.ts.MatSelect.html:1 ERROR TypeError: Cannot read property 'nativeElement' of undefined
    at MatSelect._onFadeInDone (select.es5.js:744)
    at Object.eval [as handleEvent] (index.d.ts.MatSelect.html:1)
    at handleEvent (core.js:13254)
    at callWithDebugContext (core.js:14739)
    at Object.debugHandleEvent [as handleEvent] (core.js:14326)
    at dispatchEvent (core.js:9703)
    at eval (core.js:10317)
    at eval (animations.js:348)
    at Array.forEach (<anonymous>)
    at eval (animations.js:346)
<mat-select [ngModel]="language" (change)="switchLanguage($event)"
    placeholder="{{'app.language'|translate}}" name="lang">
         <mat-option *ngFor="let lang of languages" [value]="lang.locale">
              {{lang.name}}
         </mat-option>
</mat-select>
    MatSelect.prototype._onFadeInDone = function () {
        this._panelDoneAnimating = this.panelOpen;
        this.panel.nativeElement.focus(); // <-- ERROR IS HAPPENING HERE
        this._changeDetectorRef.markForCheck();
    };

After update this error appeared. Everything works fine, just the error and small animation glitch when overlap panel fading out. Idk what to do with this error and how to fix it. Code looks pretty standard...

What is the current behavior?

  • Chrome, Linux (Solus Project)
  • Angular ^5.0.0
  • @angular/material ^2.0.0-beta.12

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions