It's very common that multiple components may need access to the same code and we don't want to copy and paste the same code over and over.
Therefore, we need create a single reusable data service and inject it in the components that need it.
(1) Create a service class looks like:
(2) Import, register and initialize the service class in component class
(3) If I add a search method in ProjectService:
(4) The component class code snippet looks like: