Todo-app full stack application using Angular, express and MySQL
Design comparison
Solution retrospective
Hello, It's my first project with Angular and I have a question about the Observables from rxjs : Should I have used the observables for this project ? AND In which case and for which features should I use observables? Should I use Observables as often as possible? Thank you !
Community feedback
- @vandermsPosted over 2 years ago
HI, well done! You did a really great job in this project.
About your question, we usually use observables when we need to handle asynchronous operations. Communication with Rest API being the most common of this operations.
Angular also uses observables on several modules like router and reactive forms.
What I am trying to say is that observables is something very common in Angular and is hard to build a project that doesn't contain any. In your case, you use HttpClient, whose methods return observables. See: https://angular.io/guide/observables-in-angular#http
And, finally, your project is amazing and well organized, the only tip that I would like to give you is that when we need a variable with different values for development and production, the best practice is to use environment variables. I am saying that because I saw that you created a variable named IP_ADDRESS, in the TodoAppService, and you commented the development value.
You can check how to set a enviroment variable in this article https://www.digitalocean.com/community/tutorials/angular-environment-variables
Marked as helpful1@SonTonyDPosted over 2 years ago@vanderms Hello, thank you very much for your feedback and thank you for taking the time to read my code. For my part, I read the article about environment variables and it was very useful to me. For observables, I will find out about it and try to use more of these in my futur projects. Anyway , I am very happy that you read my code. It is very nice feedback , thank you.
1
Please log in to post a comment
Log in with GitHubJoin our Discord community
Join thousands of Frontend Mentor community members taking the challenges, sharing resources, helping each other, and chatting about all things front-end!
Join our Discord