Skip to content

Commit 1f02f9c

Browse files
bradricePeterStaev
authored andcommitted
Update README.md (#177)
1 parent 3965bd8 commit 1f02f9c

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,16 @@ export class AppComponent {
231231
}
232232
```
233233

234+
##### Set the selectedIndex value in Angular
235+
236+
Get an instance of the child drop down component like this:
237+
238+
```
239+
@ViewChild('dd') dropDown: ElementRef;
240+
// set the index programatically from the parent component
241+
this.dropDown.nativeElement.selectedIndex = <some number from code>
242+
```
243+
234244
## Working with value and display members
235245
It is a common case that you want to have one thing displayed in the drop down and then get some backend value
236246
tied to the tex. For example drop down with states you might want tos how the full state name (i.e. Florida)

0 commit comments

Comments
 (0)