Firebase.push failed: first argument contains an invalid key ($$hashKey)

前端 未结 6 1184
太阳男子
太阳男子 2021-02-02 13:42

I recently started learning AngularJS+Firebase. I\'m trying to write in my firebase an object like this:

{
    title: \"Personal Information\",
    say: [
               


        
6条回答
  •  无人共我
    2021-02-02 14:14

    EDIT: As Anant points out in the comments, in the latest stable version of Angular (1.0.7 atm), you can use angular.copy(obj) to remove $$hashkey attributes.

    Like Michael said, the '$' in '$$hashKey' is the issue. Angular creates the $$hashKey properties behind the scenes (see more here: https://groups.google.com/forum/#!topic/angular/pI0IgNHKjxw). I've gotten around this issue by doing something like myRef.push(angular.fromJson(angular.toJson(myAngularObject))).

提交回复
热议问题