We realized the form, and now the customer can search for hotels; clicking on the search button will send a request to the backend, and we will use the result inside other components.
We need a way to enable communication between components without the need for direct referencing each other.
In the next chapter, we will look at the concept of Publish/Subscribe, but now we will go with a simple Event Manager module (following the Mediator design pattern).
When you got the files for the communication with the backend, you download BookingOnline/app/services/eventManager.js
.
This module exposes three functions:
If you check the rest.js
module, you will find there a function named getHotelByDestination
. At the end of the function...