December 2018
Intermediate to advanced
196 pages
4h 48m
English
ajax is another helper constructor; this one performs an AJAX request. It returns an observable of a single value: whatever the AJAX request returns. Here’s a simple example (note that the ajax constructor is imported from a different location than the other constructors):
| | import { ajax } from 'rxjs/ajax'; |
| | |
| | ajax('/api/managingAsync/ajaxExample') |
| | .subscribe(console.log); |
Running this code does not log data about the AJAX request to the console. Instead, a big fat error message appears in the console informing us that the URL I told you to request doesn’t exist. Until now you’ve only encountered well-behaved observables that never throw errors. Now that your code is making network requests, it’s time to figure ...
Read now
Unlock full access