firebase - AngularFire $add—TypeError: undefined is not a function -
When I select the option of push $ add-substitute, I get this error.
TypeError: There is no function on undefined scope. $ Scope.send comment (http: // localhost: 9000 / scripts / controllers / post.js: 22: 38): 10847: 21 ... Here my admin is @ post.js
$ 16 scope.sendcomment = function {17 var newComment = {18 users: $ scope.currentUser , 19 lessons: $ scope.currentText 20 21}; 22 y promise = comment service. Ad (new comet); 23 promise Then (function (name) {24 console.log (name); 25}); 26};
Here is my service (problematic add function is downwards)
(function (angle) {'strict use'; angular.module ('Comment'); var fireComment = $ firebase (commentRef); Return {childAdded: ('comment'); ('comment' service), (FBRLL, $ Q, $ Firebase) {var CommentRef = New FireBase (FBRR) function childAdded (limitNumber, cb) {commentRef.startAt (). Limit (limitNumber) .on ('child_added', function (snapshot) {var val = snapshot.val (); cb.call (this, {user : Val user, text: val.text, name: snapshot.name ()});});}, which D: Function addcomment (comment) {return fire comment. $ Add (comment);}, ....
>
$ Firebase (Remarket RF) For more than half of you, a firebird array that can call $ add ().
< P> You will need to call the return $ asArray () $ firebase (commentRef) at the return value: Var fire comentire = $ firebase (commentRF). $ AsArray ();
Then you can add
firecommentArray. $ Add (comment)
Comments
Post a Comment