Skip to content

Commit

Permalink
docs(ajax): added ajax and webSocket docs back to the list (#3984)
Browse files Browse the repository at this point in the history
  • Loading branch information
Matt Yao authored and benlesh committed Aug 3, 2018
1 parent 8fbb15e commit a5ff2c2
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 2 deletions.
5 changes: 4 additions & 1 deletion docs_app/tools/transforms/angular-api-package/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,10 @@ module.exports = new Package('angular-api', [basePackage, typeScriptPackage])
// NOTE: This list should be in sync with tools/public_api_guard/BUILD.bazel
readTypeScriptModules.sourceFiles = [
'index.ts',
'operators/index.ts'
'operators/index.ts',
'ajax/index.ts',
'webSocket/index.ts',
'testing/index.ts'
];

// API Examples
Expand Down
18 changes: 17 additions & 1 deletion src/internal/observable/dom/ajax.ts
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;

0 comments on commit a5ff2c2

Please sign in to comment.