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...
I was watching your course implementing a piece of code:
When I run the code, it throws the error:
As far as I understand I should use the playground you've shared on your github...