** This lesson is obsolete.**
You can use Select and Option elements in combination with ng-for and ng-model to create mini-forms that change your data as you make a selection.
To make this letter that we pass into our pipe dynamic, let's go ahead and add a select with some options. For our select, we want to use ngModel, so we'll go ahead and import the form directives, which has ngModel in it, and make sure that we use the form directives in here.
Then we can use our ng-model and set it to something like selected letter. In our options, we'll go ahead and loop through, using ng-4, and grab each letter of letters. We need to set up some letters for that to actually use.
We'll say E, C, and S. Then to display the letters, we'll come in here and display each letter in the options. Hit save, and you can see we now have the letters inside of our switcher. Because this is blank when it starts, let's go ahead and set the selected letter to something right away, like E is fine.
Hit save, and you can see we have all our options here. To make this letter dynamic, we'll just go ahead and drop in our selected letter. Instead of a string, it's actually pointing to what's ever selected using our ngModel.
I can come in, select C, select S, and we're good to go.
Member comments are a way for members to communicate, interact, and ask questions about a lesson.
The instructor or someone from the community might respond to your question Here are a few basic guidelines to commenting on egghead.io
Be on-Topic
Comments are for discussing a lesson. If you're having a general issue with the website functionality, please contact us at support@egghead.io.
Avoid meta-discussion
Code Problems?
Should be accompanied by code! Codesandbox or Stackblitz provide a way to share code and discuss it in context
Details and Context
Vague question? Vague answer. Any details and context you can provide will lure more interesting answers!