I'm seeking to know what would be best practice, when developing an Angular application with Firebase as a backend. Most tutorials and alike doesn't use firebase calls as a service, but run them directly in the component. Is this how you should handle using firebase in angular? since i'm thinking it would be more usefull to make services to fetch/update certain data on Firebase, since it would be reuseable across multiple components.
also, if you have any litterature or links on using firebase as a service (angular4 with Angularfire2), It would be greatly apprecieated
Calling the firebase exclusively from services and not directly in the components is definitely a good thing. It will make it easier to maintain your firebase calls and avoid duplicated code. And dependency injection in Angular will help you a lot.
If you want some inspiration you can check out this repository. Have a look at this folder where we have multiple services each responsible for a different part of the data.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With