Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Use <code>angularFire</code> if you want implicit sync, i.e. any changes made to your model will instantly propagate to all other clients (and vice versa).</p> <p>Use <code>angularFireCollection</code> if you want to be in control of when any local data changes must be sent to the server. Any remote changes will still automatically update your local collection.</p> <p>Implicit sync:</p> <pre class="lang-js prettyprint-override"><code>myapp.controller('MyCtrl', ['$scope', 'angularFire', function MyCtrl($scope, angularFire) { var promise = angularFire(url, $scope, 'items', []); } ]); </code></pre> <p>First argument is the location of the Firebase at which you want to store/retrieve data. Second argument is the scope, third argument is the name of the property under $scope you want the data bound as soon as the promise is fulfilled. For example:</p> <pre class="lang-js prettyprint-override"><code>promise.then(function() { // Data available in $scope.items }); </code></pre> <p>Fourth argument is the type of data you want in your JS object. Use <code>[]</code> for arrays, <code>{}</code> for objects, <code>""</code> for strings, <code>1</code> for numbers and <code>true</code> for boolean. Note that if no data is present in the provided Firebase location you can also use this argument to set the default value.</p> <p>In implicit sync if you want to make any changes, simply modify <code>$scope.items</code> and the change will automatically synchronize with all other clients via Firebase. Similarly, any changes made remotely will automatically update <code>$scope.items</code>.</p> <p>Explicit sync:</p> <pre class="lang-js prettyprint-override"><code>myapp.controller('MyCtrl', ['$scope', 'angularFireCollection', function MyCtrl($scope, angularFireCollection) { $scope.items = angularFireCollection(url); } ]); </code></pre> <p>This method only takes one argument. If you want to add or remove items, use the <code>add</code>, <code>remove</code> or <code>update</code> methods. For example:</p> <pre class="lang-js prettyprint-override"><code>$scope.items.add({test: "object"}); </code></pre> <p>Since <code>angularFireCollection</code> does not require a scope, you can also use this if you want to use Firebase outside of a controller (like angular directives, modules, etc.) Hope this helps!</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload