Reshad
Reshad

Reputation: 2652

three way binding returns $bindTo is not a function

Hi I have the following setup to bind my FirebaseArray in angularjs in order to sync the list when a date changes.

var vm = this;

vm.startDate = {
  startDate: moment().startOf('month'),
  endDate: moment().endOf('month')
};
vm.bonnen = $firebaseArray(bonCollection($rootScope.user.uid, vm.startDate.startDate, vm.startDate.endDate));
vm.bonnen.$bindTo(vm, "vm.startDate");

However, I keep getting the following error

Error: vm.bonnen.$bindTo is not a function. (In 'vm.bonnen.$bindTo(vm, "vm.startDate")', 'vm.bonnen.$bindTo' is undefined)

What am I possibly doing wrong here?

Upvotes: 0

Views: 165

Answers (1)

Mathew Berg
Mathew Berg

Reputation: 28750

$bindTo is only available for $firebaseObject

Docs: https://www.firebase.com/docs/web/libraries/angular/api.html#angularfire-firebaseobject-bindtoscope-varname

Discussion on why it can't be: https://github.com/firebase/angularfire/issues/600

Upvotes: 1

Related Questions