Reacting to Domain Events
Explore how to handle domain events in your Angular application by subscribing to events and updating UI components. Learn to close sidebars after login, show the logged-in username, and dynamically toggle UI elements based on user login status.
We'll cover the following...
Our Angular application is almost complete. There are a few things that we still need to do in order to round it out.
-
Firstly, once a user has completed the login form, we should close the login sidebar and show the main content once again.
-
Secondly, we should update the user-details component to show the currently logged-in username, as well as hide the “login” button. These changes can all occur on the back of the domain event
USER_LOGIN_EVENT. To hide the sidebar, we need to react to theUSER_LOGIN_EVENT...