How to bind these code in firebase and make automatic sync, I want to check the attended invitees
var guestApp = angular.module("guestApp", []);
guestApp.controller('guestCtrl', function($scope) {
$scope.guests = ['jean','elie','tierry'];
$scope.addGuest = function(){
$scope.guests.push($scope.newGuest);
$scope.newGuest = '';
};
$scope.removeGuest = function(guest){
var i = $scope.guests.indexOf(guest);
$scope.guests.splice(i,1);
};
First, you need to make sure to have those libraries included in your HTML:
As for the code itself:
You need to add firebase module dependency:
Then, in your controller you need to inject proper firebase service and log authenticate:
After that you can bind a scope variable to your firebase reference:
As for adding new item:
And removing:
I guess that's it. Btw. you can read all about it in the official documentation ;) https://www.firebase.com/docs/web/libraries/angular/quickstart.html