Skip to content

Conversation

@feloy
Copy link
Contributor

@feloy feloy commented Oct 12, 2016

Document the MdInput focus() method

@googlebot googlebot added the cla: yes PR author has agreed to Google's Contributor License Agreement label Oct 12, 2016
@feloy feloy changed the title Md input focus Document MdInput focus() method Oct 12, 2016
@feloy feloy changed the title Document MdInput focus() method docs: Document MdInput focus() method Oct 12, 2016
@fxck
Copy link
Contributor

fxck commented Oct 13, 2016

I think really think this belongs to the docs, it's a workaround for a missing feature(autofocus)..

### Example

```html
<md-input #nameInput placeholder="name"></md-input>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The #nameInput isn't necessary in this example because you're using @ViewChild with the class. I'd omit it so that people don't mistakenly get the impression that a @ViewChild name has to match some template variable name.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're right, I used the ViewChild incorrectly. What I wanted to write was instead:
@ViewChild('nameInput') nameInput: MdInput;
to that this sample still works when multiple md-input are present in the template.
Do you agree?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, that works too.

@jelbourn jelbourn merged commit 3bb667e into angular:master Oct 17, 2016
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 6, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

cla: yes PR author has agreed to Google's Contributor License Agreement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants