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:
parent
b621a69cda
commit
f6c91c5a5a
|
@ -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); },
|
||||
|
|
Loading…
Reference in New Issue