Heads up! To view this whole video, sign in with your Courses account or enroll in your free 7-day trial. Sign In Enroll
Well done!
You have completed Vue.js Basics!
You have completed Vue.js Basics!
Preview
In this video, we'll write JavaScript inside of a Vue directive to add functionality that deletes a card.
This video doesn't have any notes.
Related Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign upRelated Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign up
So when the user clicks on
the x on any given card,
0:00
we need an event to fire that deletes
that card from the cards array.
0:01
We'll use the splice method to find and
delete whatever card we've clicked on.
0:06
To do that, we'll first need
to get the index of the card.
0:11
In the view template, let's go to where
we're looping through the cards array.
0:16
In parentheses,
we'll change this to card and index.
0:22
Recall that index is an optional
argument for the v-for directive.
0:28
You need to sign up for Treehouse in order to download course files.
Sign upYou need to sign up for Treehouse in order to set up Workspace
Sign up