docs: fix table in comparing observables guide (#22485)
PR Close #22485
This commit is contained in:
parent
66547d8fd0
commit
8d0f8bd657
@ -89,22 +89,25 @@ promise.then(() => {
|
||||
The following code snippets illustrate how the same kind of operation is defined using observables and promises.
|
||||
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Operation</th>
|
||||
<th>Observable</th>
|
||||
<th>Promise</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>Creation</td>
|
||||
<td>
|
||||
<pre>new Observable((observer) => {
|
||||
observer.next(123);
|
||||
});</pre>
|
||||
});</pre>
|
||||
</td>
|
||||
<td>
|
||||
<pre>new Promise((resolve, reject) => {
|
||||
resolve(123);
|
||||
});</pre>
|
||||
});</pre>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
@ -117,12 +120,12 @@ The following code snippets illustrate how the same kind of operation is defined
|
||||
<td>
|
||||
<pre>sub = obs.subscribe((value) => {
|
||||
console.log(value)
|
||||
});</pre>
|
||||
});</pre>
|
||||
</td>
|
||||
<td>
|
||||
<pre>promise.then((value) => {
|
||||
console.log(value);
|
||||
});</pre>
|
||||
});</pre>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
@ -130,6 +133,7 @@ The following code snippets illustrate how the same kind of operation is defined
|
||||
<td><pre>sub.unsubscribe();</pre></td>
|
||||
<td>Implied by promise resolution.</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
## Observables compared to events API
|
||||
|
Loading…
x
Reference in New Issue
Block a user