Skip to content

TypeError: this._getHostElement(...).focus is not a function #6292

@GuskiS

Description

@GuskiS

Bug, feature request, or proposal:

Bug

What is the expected behavior?

Using this guide I would like to be able render app without errors.

What is the current behavior?

Currently I'm recieving error:

ERROR { Error: Uncaught (in promise): TypeError: this._getHostElement(...).focus is not a function
TypeError: this._getHostElement(...).focus is not a function
    at MdOption.focus (home_path/node_modules/@angular/material/bundles/material.umd.js:1638:32)
    at FocusKeyManager.setActiveItem (home_path/node_modules/@angular/material/bundles/material.umd.js:6787:29)
    at MdSelect._selectValue (home_path/node_modules/@angular/material/bundles/material.umd.js:7454:30)
    at MdSelect._setSelectionByValue (home_path/node_modules/@angular/material/bundles/material.umd.js:7431:18)
    at MdSelect.writeValue (home_path/node_modules/@angular/material/bundles/material.umd.js:7237:18)
    at home_path/node_modules/@angular/forms/bundles/forms.umd.js:1810:29
    at home_path/node_modules/@angular/forms/bundles/forms.umd.js:2996:65
    at Array.forEach (native)
    at FormControl.setValue (home_path/node_modules/@angular/forms/bundles/forms.umd.js:2996:28)
    at home_path/node_modules/@angular/forms/bundles/forms.umd.js:4398:60
    at resolvePromise (home_path/node_modules/zone.js/dist/zone-node.js:783:31)
    at home_path/node_modules/zone.js/dist/zone-node.js:834:17
    at ZoneDelegate.invokeTask (home_path/node_modules/zone.js/dist/zone-node.js:424:31)
    at Object.onInvokeTask (home_path/node_modules/@angular/core/bundles/core.umd.js:3913:33)
    at ZoneDelegate.invokeTask (home_path/node_modules/zone.js/dist/zone-node.js:423:36)
    at Zone.runTask (home_path/node_modules/zone.js/dist/zone-node.js:191:47)
    at drainMicroTaskQueue (home_path/node_modules/zone.js/dist/zone-node.js:595:35)
    at ZoneTask.invokeTask (home_path/node_modules/zone.js/dist/zone-node.js:502:21)
    at ZoneTask.invoke (home_path/node_modules/zone.js/dist/zone-node.js:487:48)
    at data.args.(anonymous function) (home_path/node_modules/zone.js/dist/zone-node.js:1063:25)

However, I'm still able to produce out html.

What are the steps to reproduce?

I have these modules
Looking at the error message it seems that select is causing this, so here is my select:
Example code:

...
  buttons = ["left", "middle", "right"]
  button = this.buttons[0]
...
  <md-select (change)="change()" [(ngModel)]="button">
    <md-option *ngFor="let mb of buttons" [value]="mb">{{ mb | uppercase }}</md-option>
  </md-select>
...

Which versions of Angular, Material, OS, TypeScript, browsers are affected?

Angular - 4.3.3
Material - 2.0.0-beta.8
OS - Ubuntu 16.10
TypeScript - 2.4.2

Is there anything else we should know?

For some reason Current document does not have a doctype. This may cause some Angular Material components not to behave as expected. is outputed, however, I do have doctype.

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