Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make MdlTextFieldComponent::setFocus() public #81

Closed
grizzm0 opened this issue Sep 14, 2016 · 4 comments
Closed

Make MdlTextFieldComponent::setFocus() public #81

grizzm0 opened this issue Sep 14, 2016 · 4 comments
Assignees

Comments

@grizzm0
Copy link

grizzm0 commented Sep 14, 2016

I've got an input that always needs to keep focus.

I'm switching over to angular2-mdl from angular2-material as it's lacking a lot of features. I had something similar working in angular2-material already and tried the following when switching to angular2-mdl. But setFocus() is protected which breaks the whole thing.

<mdl-textfield #input [autofocus]="true" (blur)="focus()" ...></mdl-textfield>
export class InputScanner implements OnInit {
  @ViewChild('input') input:MdlTextFieldComponent;

  protected focus():void {
    this.input.setFocus();
  }
}

Edit:
Don't forget to create an if-statement to make sure this.inputEl is set. ;)

@mseemann
Copy link
Owner

will be part of the next release.

@grizzm0
Copy link
Author

grizzm0 commented Sep 14, 2016

@mseemann As my edit stated you might want to make sure this.inputEl is actually set. Ran into an error there myself while playing around.

mseemann added a commit that referenced this issue Sep 14, 2016
@mseemann
Copy link
Owner

see 81bc83b

@mseemann
Copy link
Owner

npm version 1.7.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants