GithubHelp home page GithubHelp logo

rxjs-playground's People

Contributors

jerrydoubleu avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

rxjs-playground's Issues

ajax in RxJS

I was watching your course implementing a piece of code:

type Food = {
    id: number
    uid: string
    dish: string
    description: string
    ingredient: string
    measurement: string
}
type Nation = {
    id: number
    uid: string
    nationality: string
    language: string
    capital: string
    national_sport: string
    flag: string
}
type Name = {
    id: number
    uid: string
    name: string
    two_word_name: string
    four_word_name: string
    name_with_initials: string
    name_with_middle: string
    first_name: string
    middle_name: string
    last_name: string
    male_first_name: string
    female_first_name: string
    prefix: string
    initials: string
}



const randomName$ = ajax<Name>('https://random-data-api.com/api/name/random_name');
const randomNation$ = ajax<Nation>('https://random-data-api.com/api/nation/random_nation');
const randomFood$ = ajax<Food>('https://random-data-api.com/api/food/random_food');

forkJoin([randomName$, randomNation$, randomFood$]).subscribe(
    ([nameAjax, nationAjax, foodAjax]) => {
        console.log(`${nameAjax.response.first_name} ${nationAjax.response.capital} ${foodAjax.response.dish} `)
    }
)

When I run the code, it throws the error:

/node_modules/rxjs/src/internal/ajax/ajax.ts:397
    xhr = init.createXHR ? init.createXHR() : new XMLHttpRequest();
                                                  ^
ReferenceError: XMLHttpRequest is not defined

As far as I understand I should use the playground you've shared on your github...

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.