docs: update rxjs example and change fromPromise to from (#27443)

the first example at https://angular.io/guide/rx-library,
https://github.com/ReactiveX/rxjs-tslint/issues/7

PR Close #27443
This commit is contained in:
Zheng Kai 2018-12-04 07:41:17 +08:00 committed by Kara Erickson
parent b621a69cda
commit f6c91c5a5a
1 changed files with 2 additions and 2 deletions

View File

@ -1,10 +1,10 @@
// #docregion promise
import { fromPromise } from 'rxjs';
import { from } from 'rxjs';
// Create an Observable out of a promise
const data = fromPromise(fetch('/api/endpoint'));
const data = from(fetch('/api/endpoint'));
// Subscribe to begin listening for async result
data.subscribe({
next(response) { console.log(response); },