且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

AngularFire $add—TypeError: undefined 不是函数

更新时间:2022-12-09 11:23:30

$firebase(commentRef) 只能让您获得可以调用 $add() 的 firebase 数组.

$firebase(commentRef) only gets you half way to a firebase array that can call $add().

您必须另外对 $firebase(commentRef) 的返回值调用 $asArray() ,如下所示:

You must additionally call $asArray() on the return value of $firebase(commentRef) like so:

var fireCommentArray = $firebase(commentRef).$asArray();

然后你可以

fireCommentArray.$add(comment)