javascriptrxjsrxjs5rxjs-dom

RxJS ajax returns null response


I'm trying to retrieve some data using rxjs. It returns 200, but response is null. Is there any extra step to retrieve response?

Test api; https://reqres.in

Thanks.

import {ajax} from 'rxjs/observable/dom/ajax';

import 'rxjs/add/operator/map';


ajax.get({
            url: "https://reqres.in/api/users?page=2",
            // crossDomain: true,
            method: "GET",
        })
            .subscribe(data => {
                console.log(data)
                debugger
            })

enter image description here


Solution

  • Never mind,

    It should be ajax() not ajax.get()