@Output
decorator in conjunction with the EventEmitter
. The below code has been seen by any Angular developer:@Output
can decorate any "observable" property. The Angular compiler emits needful information for the Angular itself that says "hey, please subscribe to the search
class property and dispatch CustomEvent
any time the observable emits".@Output
.app-email-list
custom element that emits messagesLoaded
DOM event and gives the data to the team B for analytics. Given the following code:LoadMessages
action every time the user clicks "Refresh messages" button. After the LoadMessages
action handler has completed his asynchronous job we emit the messagesLoaded
event. Let's be more declarative:ButtonComponent.click
is an EventEmitter
. Wow, we've done it in a more declarative and reactive way. So every time the user clicks the app-button
our switchMap
will produce the next store.dispatch
subscribe and unsubscribe from the previous one. Next we use the map
operator that will map our stream value to the Message[]
array from our state.Actions
stream. Assume we've got a component that emits booksLoaded
event every time when different genre of books are loaded: