-
Notifications
You must be signed in to change notification settings - Fork 3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs(ajax): added ajax and webSocket docs back to the list (#3984)
- Loading branch information
Showing
2 changed files
with
21 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,19 @@ | ||
import { AjaxObservable, AjaxCreationMethod } from './AjaxObservable'; | ||
|
||
/** | ||
* There is an ajax operator on the Rx object. | ||
* | ||
* It creates an observable for an Ajax request with either a request object with | ||
* url, headers, etc or a string for a URL. | ||
* | ||
* ## Using ajax.getJSON() to fetch data from API. | ||
* ```javascript | ||
* import { ajax } from 'rxjs/ajax'; | ||
* import { map, catchError } from 'rxjs/operators'; | ||
* | ||
* const obs$ = ajax.getJSON(`https://api.github.com/users?per_page=5`).pipe( | ||
* map(userResponse => console.log('users: ', userResponse)), | ||
* catchError(error => console.log('error: ', error)) | ||
* )); | ||
* ``` | ||
*/ | ||
export const ajax: AjaxCreationMethod = AjaxObservable.create; |