---
# System prepended metadata

title: Async pipe

---

# Async pipe

2 possible semantics:
* we don't want default value
* it is more of INITIAL value (before subscription emits)
  * Very similar DX to `(obs | async) ?? initialFoo` (for non-nullable `obs`)
  * sometimes it is "hard" to come up with a meaningful "initial value"
* I've got sth that has a value when I subscribe
    * doesn't work with promises
    * observable can change its nature as code gets changed (and people changing code are not aware of the read semantics)


## I've got sth that has a value when I subscribe

Options:
* Create a new pipe (`syncAsync`)
* Accept a boolean argument (`obs$ | async:true`)
* Operator which wraps the observable somehow (`enforceSync(obs$) | async`)
* Lazy initial value `(obs$ | async:makeInitialValue`)