In order to award users with gifts, we'll need a way to choose a random entry. This can be a bit tricky, because we'll need to modify the display within our list to react to some new methods.
- [Instructor] So, I want to add another…bit of functionality to this app.…Occasionally during a meeting,…I'd like to pick a random user from this list…so perhaps I can do a giveaway to one of those users.…So, I'm going to add this functionality to the app,…I'm going to create a button first…to go ahead and activate that feature.…That's got to be done in the checkinslist,…so right after this form group right here,…I'm going to create another div…and it's going to have a class of buttons…and a clearfix as well, and then in here…I'm going to create two buttons.…
The first button will normally be hiding,…unless there is a variable we're…going to create called recordId.…So, this is going to identify…the record that I want to pick.…We'll give this button an ng-click,…so that when we click it, it executes a method…that we're going to create called pickRandom.…We'll have to create that method,…and this we'll just say Pick Random.…
Let's go ahead and put ng-hide on the next line,…and this is going to need a couple…of classes as well to make it look nice.…
Learn how to create forms, edit database records, create methods, randomize record selections, and style and secure your app. With these project-based lessons, you'll learn how to see how data-driven programming with AngularJS can help your apps react to real-time data streams.
- Customizing an Angular template
- Adding forms to create meetings and check in users
- Adding, showing, and deleting database records
- Using events to track meetings
- Adding a form to the app
- Creating methods
- Randomizing prizes
- Creating conditional styles
- Managing app permissions