Join egghead, unlock knowledge.

Want more egghead? It's 45% off for a limited time only!

This lesson is for members. Join us? Get access to all 3,000+ tutorials + a community with expert developers around the world.

Unlock All Content for 45% Off

Already subscribed? Sign In

Save 45% for a limited time.

Get access to all courses and lessons on egghead today.


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

    John LindquistJohn Lindquist

    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.



    Become a Member to view code

    You must be a Member to view code

    Access all courses and lessons, track your progress, gain confidence and expertise.

    Become a Member
    and unlock code for this lesson


    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.