⚠️ This lesson is retired and might contain outdated information.

Map Click Event Streams to Load Data with Vue.js and RxJS

John Lindquist
InstructorJohn Lindquist
Share this video with your friends

Social Share Links

Send Tweet
Published 6 years ago
Updated a month ago

This lesson shows how to domStreams with v-stream on a button inside of a Vue.js template, map the click to a data request with RxJS streams, then return that data back into the Vue.js template.

Instructor: [00:00] Now, instead of directly loading the person, let's click and then load it. The way that we do that is by, instead of mapping, we do what's called a switch map, and the switch map takes a function and returns an observable. I'm going to return the observable of people.

[00:17] Instead of calling this random, let's call it something like Luke, because that's who it's going to load. We'll put in Luke here, and make sure that Luke shows up here. Now, when I click on this button, you'll see that Luke loads in. If I change this to a two, it won't load Luke anymore.

[00:38] Instead, when I click, it'll load C-3PO. But we'll go ahead and keep that one for now. I'll click and load in Luke.

egghead
egghead
~ 15 minutes ago

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

  • This was great!
  • This was horrible!
  • I didn't like this because it didn't match my skill level.
  • +1 It will likely be deleted as spam.

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!

Markdown supported.
Become a member to join the discussionEnroll Today