4 ms·
I really wanted this article to get into the meat of how to build an Angular app with Firebase. It gets the basics working but it would've been nice to see some
by drhayes9 13y ago
I really wanted this article to get into the meat of how to build an Angular app with Firebase. It gets the basics working but it would've been nice to see some details about Firebase security, good practices about what goes where with respect to what AngularFire provides, etc.
I've only been playing around with it but I thought I'd add some ideas that are working so far for me:
- Don't use your Firebase URL all over the place in your app.
- DRY it up by creating an AngularJS constant for your main Firebase instance (e.g. "module.constant('baseStore', new Firebase('https://whatever.firebaseio.com'));" https://whatever.firebaseio.com'));").
- Every sub reference to the base now uses the "child" method off that baseStore object to get sub-objects (e.g. "var props = baseStore.child('props');").
- Create an auth service that your app uses instead of using the AngularFire auth libs directly. Makes it much easier to control/test your auth flow, especially if you change from "email/password" to, say, "persona".
I still have some questions about the interactions between Angular and Firebase/AngularFire but maybe I'll save them for a StackOverflow question. ( =
- joshstrange 13y agoCouldn't agree more, I have run into the same things it appears you have and come to similar conclusions. That was what was hardest for me when getting started, there are a billion examples of how to write a chat app, a todo list, etc but none of the examples I came across had, as you call it the "meat of how to build and Angular app with Firebase". I felt like most of what I was seeing was gimmicky and had no real use (on it's own).
- drhayes9 13y agoYup. I'm also trying to learn AngularJS at the same time so the hits, they keep'a'coming. ( = It would be nice in the AngularFire documentation if they were clear what was a promise (implicit binding) and what wasn't (explicit binding). One of the things I ran into (which I hope they add to the documentation): before using implicit binding, create the object on the $scope in your controller first. Only after the empty object is on the scope should you call "angularFire(ref, $scope, 'thing');". The error that shows up if you don't do that is rather cryptic.
- joshstrange 13y agoYes, I too ran into this problem and found the answer in the github issue tracker[0]. I ran into other issues in the 0.2.0->0.3.0 change where they made quite a few small changes without releasing any upgrade instructions or changelog. [0] https://github.com/firebase/angularFire/issues/105 https://github.com/firebase/angularFire/issues/105
- sararob 13y agoThanks for the feedback (Firebase Community Manager here). We're working on improving the documentation. Feel free to email me at sara@firebase.com if you have more suggestions.