mirror of
https://github.com/angular/angular.git
synced 2026-09-14 13:54:52 +08:00
docs: document MdInput focus() method (#1486)
This commit is contained in:
committed by
Jeremy Elbourn
parent
e4af65afc9
commit
3bb667e907
@@ -86,7 +86,25 @@ The divider (line under the `<md-input>` content) color can be changed by using
|
||||
|
||||
You can label the `<md-input>` as you would a regular `<input>`.
|
||||
|
||||
## Focus
|
||||
|
||||
You can put the focus on an input component using the `focus()` method.
|
||||
|
||||
### Example
|
||||
|
||||
```html
|
||||
<md-input #nameInput placeholder="name"></md-input>
|
||||
```
|
||||
|
||||
```ts
|
||||
export class MyComponent implements OnInit {
|
||||
@ViewChild('nameInput') nameInput: MdInput;
|
||||
|
||||
ngOnInit() {
|
||||
this.nameInput.focus();
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Full Forms
|
||||
|
||||
|
||||
Reference in New Issue
Block a user