Join Justin Yost for an in-depth discussion in this video Delete a record, part of Ember.js Essential Training.
- [Narrator] The last thing we'll cover…is deleting a record.…To delete a record, we'll add a button to delete the records…on our edit page and then persist that to the server.…To do so, first we'll add a new action to our component…that will respond to a delete action.…So open the app, components, bookmarks, edit form.…After line 22, where we have our cancel action,…we'll want to add a comma…and then add a hook for our delete action.…We'll have delete, and delete in this case,…much like save, is going to take the bookmark…that we're going to delete.…
So we'll add bookmark as a property for the delete hook.…After this, we can call the destroy record method…on the bookmark, which deletes the model record.…So line 24 will read as bookmark.destroyRecord.…After this, we can transition back…to our bookmark's index route.…Following the same pattern that we used for the save action,…it will be this.get router .transitionTo bookmarks.…
After this, we can modify our component…to add a delete button but only if our bookmark…
- Why choose Ember?
- Installing Ember.js and Ember Inspector
- Defining the model
- Creating nested and dynamic routes
- Loading templates with routes
- Rendering different templates
- Displaying collections
- Working with Ember components
- Building forms
- Creating, editing, and deleting records
- Configuring Ember.js applications
- Testing your Ember application
- Installing add-ins
- Upgrading an Ember application
Skill Level Intermediate
1. Ember.js Basics
2. Getting Started with Ember.js
3. Our First Ember.js Application
4. Ember.js Routes
5. Ember.js Models
6. Ember.js Templates
7. Ember.js Components
9. Application Configuration
Build an app for production3m 29s
11. The Ember.js Community
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.