Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Quick Question #1

Open
manentea opened this issue Aug 1, 2015 · 1 comment
Open

Quick Question #1

manentea opened this issue Aug 1, 2015 · 1 comment

Comments

@manentea
Copy link

manentea commented Aug 1, 2015

Hey, I found your tutorial and just had a quick question for you.

In these lines here

var events = $firebase(firebaseEvents);
$scope.events = [events.$asArray()];

Because we need an array of events wouldn't it be beneficial to use $firebaseArray since AngularFire provides that as well? Or is there a reason it's done this way?

@manentea
Copy link
Author

manentea commented Aug 1, 2015

.controller('calendar', ['$scope', '$firebase', function($scope, $firebaseArray){

  var firebaseEvents = new Firebase("https://{{FIREBASE URL}}.firebaseio.com/");
  var events = $firebaseArray(firebaseEvents);


  $scope.newEvent = {
    title: '',
    start: ''
  };

  $scope.addEvent = function(){
    events.$add($scope.newEvent);

    $scope.newEvent = {
      title: '',
      start: ''
    };
  }

I'm fairly certain this will work as well

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant