Syncing Data With Firebase Using Ionic Framework

$scope.list = function() {
    fbAuth = fb.getAuth();
    if(fbAuth) {
        var sync = $firebase(fb.child("users/" + fbAuth.uid));
        var syncObject = sync.$asObject();
        syncObject.$bindTo($scope, "data");
    }
}

Once syncObject is bound to $scope.data, which is provided by AngularFire, data will be synchronized consistently in three ways (UI, $scope.data, and Firebase): Calling $scope.data.todos.push({title: result}); will update the UI and also sync it to Firebase; no further code adjustments are required.

Syncing Data With Firebase Using Ionic Framework →

Published by Bramus!

Bramus is a frontend web developer from Belgium, working as a Chrome Developer Relations Engineer at Google. From the moment he discovered view-source at the age of 14 (way back in 1997), he fell in love with the web and has been tinkering with it ever since (more …)

Leave a comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.