My golden rules for Angular intercomponent data communication

These are some rules that I have lazily picked up over the past four years of professional development on angular.

I generally work on small to medium projects without the time to integrate a formal state management system.

It is for this reason tha…


This content originally appeared on DEV Community and was authored by Vladyslav Yakovenko

These are some rules that I have lazily picked up over the past four years of professional development on angular.

I generally work on small to medium projects without the time to integrate a formal state management system.

It is for this reason that there are data services that try to solve the problem of carrying communication around. If anyone has any further questions or curiosities regarding these points feel free to leave a comment.

  • methods must be extracted into functions until nothing can be extracted anymore
  • the component logic shold refer only to local resources of the component as much as possible
  • dataservices deal with data I/O with the server
  • the business Logic must live within the dataservice and all components should be of assistance to the business Logic, visualization assistance and small local logics to visualize and modify data
  • components (internal to the feature internal to the root component) must implement the root dataservice or receive data as input (observables are strongly preferred)
  • avoid multi-level handovers through inputs, it slows you down and makes refactoring a hassle
  • if the data as input changed hands more than twice use a dataservice,
  • each feature must have its own module and declare components related only to that feature
  • putting the general dataservice next to the feature module is the best way to indicate the root from which to start exploring the code
  • the beginning of the end of the data flow must take place within the dataservice
  • the substrate cache-services for API calls must live in the provide of the feature module they belong to and refer to
  • components can be interaction contexts between dataservices but services are preferred when possible
  • interaction services can be interaction contexts between dataservices


This content originally appeared on DEV Community and was authored by Vladyslav Yakovenko


Print Share Comment Cite Upload Translate Updates
APA

Vladyslav Yakovenko | Sciencx (2021-11-22T20:52:02+00:00) My golden rules for Angular intercomponent data communication. Retrieved from https://www.scien.cx/2021/11/22/my-golden-rules-for-angular-intercomponent-data-communication/

MLA
" » My golden rules for Angular intercomponent data communication." Vladyslav Yakovenko | Sciencx - Monday November 22, 2021, https://www.scien.cx/2021/11/22/my-golden-rules-for-angular-intercomponent-data-communication/
HARVARD
Vladyslav Yakovenko | Sciencx Monday November 22, 2021 » My golden rules for Angular intercomponent data communication., viewed ,<https://www.scien.cx/2021/11/22/my-golden-rules-for-angular-intercomponent-data-communication/>
VANCOUVER
Vladyslav Yakovenko | Sciencx - » My golden rules for Angular intercomponent data communication. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2021/11/22/my-golden-rules-for-angular-intercomponent-data-communication/
CHICAGO
" » My golden rules for Angular intercomponent data communication." Vladyslav Yakovenko | Sciencx - Accessed . https://www.scien.cx/2021/11/22/my-golden-rules-for-angular-intercomponent-data-communication/
IEEE
" » My golden rules for Angular intercomponent data communication." Vladyslav Yakovenko | Sciencx [Online]. Available: https://www.scien.cx/2021/11/22/my-golden-rules-for-angular-intercomponent-data-communication/. [Accessed: ]
rf:citation
» My golden rules for Angular intercomponent data communication | Vladyslav Yakovenko | Sciencx | https://www.scien.cx/2021/11/22/my-golden-rules-for-angular-intercomponent-data-communication/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.