Firebase Flashcards
Create firebase object
ref = new Firebase ‘https://gtrack.firebaseio.com/tracks’
Connect firebase service to angular
ref = new Firebase ‘https://gtrack.firebaseio.com/tracks’
tracks = $firebase(ref)
Get data as objects
tracks = $firebase(ref)
$scope.tracks = tracks.$asObject()
Get actual timestamp
Firebase.ServerValue.TIMESTAMP
Delete object
$firebase(ref).remove(key)
Add object
$firebase(ref).push(object)
Do something when user authentication changes
ref.onAuth(function(authData))
if (authData) : user logged in
else logged out
Get email from password based authentication data
ref = new Firebase config.fireBaseRef
authObj = $firebaseAuth ref
authObj.password.email
Watch for changes in the data
tracksArray = $firebase(ref).$asArray()
tracksArray.$watch (event) ->
Get data as array
tracksArray = $firebase(ref).$asArray()