Join Ray Villalobos for an in-depth discussion in this video Deleting award records, part of AngularJS 1: Building a Data-Driven App.
- View Offline
- All right, to finish up this app,…let's go ahead and give the users the ability…to delete awards.…So right now, we've only got a single award right here,…and we'll need to add a Delete button.…We'll do that right next to the award,…so right here, underneath where we display the award,…we're going to create a button.…And we'll actually create first a div…with a class of buttons,…and this is only going to show up if the user…is registered and logged in,…so only if there's a current user.…
And then we're going to create a button.…This one's going to have…a class of btn, btn-delete.…just like before, and then it'll also have…an award tooltip class.…Let's go ahead and make this window bigger,…so we can see this better.…And when somebody clicks on this button,…we'll use the ng-click directive,…we will execute a function called deleteLove,…and we'll pass along the ID of the checkin…that we want to delete.…
So we'll say checkin.$id,…as well as the key of the checkin.…So let's go ahead and add the span,…and this is just so the tooltip shows up,…
Although it's easy to learn, AngularJS can be hard to master. With these project-based lessons, you'll learn how the framework works in the real world, and see how data-driven programming can help your apps react to real-time data streams.
- Creating a new view
- Adding, showing, and deleting database records
- Using events to track meetings
- Adding a form to the app
- Creating methods
- Controlling views with classes