Skip to content

Commit 5a04ab6

Browse files
feloyjelbourn
authored andcommitted
docs(input): call focus on AfterViewInit vs OnInit (#1804)
1 parent 11f001b commit 5a04ab6

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/lib/input/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,10 +97,10 @@ You can put the focus on an input component using the `focus()` method.
9797
```
9898

9999
```ts
100-
export class MyComponent implements OnInit {
100+
export class MyComponent implements AfterViewInit {
101101
@ViewChild('nameInput') nameInput: MdInput;
102102

103-
ngOnInit() {
103+
ngAfterViewInit() {
104104
this.nameInput.focus();
105105
}
106106
}

0 commit comments

Comments
 (0)