googlearchive / angularfire-seed

Seed project for AngularFire apps
http://angularfire.com
MIT License
410 stars 191 forks source link

Error, when I try to send the form to Firebase #95

Closed ghost closed 8 years ago

ghost commented 8 years ago

Cannot call $add method on a destroyed $firebaseArray object My security JSON

{
  "rules": {
    "projects": {
      ".read": "root.child('users').child(auth.uid).child('active').val() == true",
      ".write": true
    },
    "users": {
      "$users": {
      ".read": true,
      ".write": true
      }
    }
  }
}

Console error Error: Cannot call $add method on a destroyed $firebaseArray object at Object.d._assertNotDestroyed (https://cdnjs.cloudflare.com/ajax/libs/angularFire/1.1.3/angularfire.min.js:12:5167) at Object.d.$add (https://cdnjs.cloudflare.com/ajax/libs/angularFire/1.1.3/angularfire.min.js:12:1986) at Scope.$scope.addSurvey (http://localhost:9000/scripts/controllers/profile.js:73:35) at fn (eval at <anonymous> (http://localhost:9000/bower_components/angular/angular.js:14086:15), <anonymous>:4:218) at expensiveCheckFn (http://localhost:9000/bower_components/angular/angular.js:15076:18) at callback (http://localhost:9000/bower_components/angular/angular.js:24546:17) at Scope.$eval (http://localhost:9000/bower_components/angular/angular.js:16820:28) at Scope.$apply (http://localhost:9000/bower_components/angular/angular.js:16920:25) at HTMLButtonElement.<anonymous> (http://localhost:9000/bower_components/angular/angular.js:24551:23) at HTMLButtonElement.jQuery.event.dispatch (http://localhost:9000/bower_components/jquery/dist/jquery.js:4732:27)

katowulf commented 8 years ago

Once $destroy has been called, the object/array should be discarded. The point of $destroy is to cancel all listeners and free memory. So the error message is working as intended here.