11angularFire
22===========
3- angularFire is an [ AngularJS] ( http://angularjs.org/ ) service that integrated
3+ angularFire is an [ AngularJS] ( http://angularjs.org/ ) service that integrates
44with [ Firebase] ( http://www.firebase.com ) so you can easily add real-time
55features to your app!
66
@@ -21,7 +21,7 @@ Include both firebase.js and angularFire.js in your application.
2121<script src =" angularFire.js" ></script >
2222```
2323
24- Add the module ` firebase ` as a dependency for your app module:
24+ Add the module ` firebase ` as a dependency to your app module:
2525
2626``` js
2727var myapp = angular .module (' myapp' , [' firebase' ]);
@@ -45,11 +45,13 @@ myapp.controller('MyCtrl', ['$scope', 'angularFire',
4545]);
4646```
4747
48- Bind a Firebase URL to any model in ` $scope ` :
48+ Bind a Firebase URL to any model in ` $scope ` . The fourth argument is the type
49+ of model you want to use (can be any JavaScript type, you mostly want a
50+ dictionary or array):
4951
5052``` js
5153var url = ' https://<my-firebase>.firebaseio.com/items' ;
52- $scope .items = angularFire (url, $scope, ' items' );
54+ $scope .items = angularFire (url, $scope, ' items' , [] );
5355```
5456
5557Use the model in your markup as you normally would:
@@ -64,7 +66,7 @@ Data from Firebase is loaded asynchronously, so make sure you edit the model
6466* only after the promise has been fulfilled* . You can do this using the ` then `
6567method (See the
6668[ Angular documentation on $q] ( http://docs.angularjs.org/api/ng.$q )
67- for more no how promises work).
69+ for more on how promises work).
6870
6971Place all your logic that will manipulate the model like this:
7072
@@ -86,7 +88,7 @@ for a working example of this pattern.
8688
8789Option 2: Explicit synchronization
8890---------------------------------
89- This is method is great if you want control over when local changes are
91+ This method is great if you want control over when local changes are
9092synchronized to Firebase. Any changes made to a model won't be synchronized
9193automatically, and you must invoke specific methods if you wish to update the
9294remote data. All remote changes will automatically appear in the local model
0 commit comments