angularjs - Angularfire $save array -



angularjs - Angularfire $save array -

i'm trying save collection of info after have updated entry in array.

// edit post $scope.editme = function(message) { if($scope.textboxmessage = "what did today?"){ $scope.textboxmessage = "here can edit post entering new message , pressing edit on affected post" + "\n \n" + "your post:" + "\n" + message.post; } else{ $scope.message.post="hello"; //$scope.newmessage $scope.messages.$save(2); } }

ones user have entered text in textfield want replace stored data. overwriting message.data sometext. since read in info this:

var list = fbutil.syncarray('posts/'+user.uid);

i tried say:

message.post = $scope.newmessage; list.$save()

neither of these 2 methods work i'm sure it's minor mistake.

ed: according angularfire api, visit: https://www.firebase.com/docs/web/libraries/angular/api.html#angularfire-firebasearray-save-recordorindex

list[2].post = "hello"; list.$save(2);

should work have had no luck.

okay here how solved it:

the problem had more if else statement server code itself. $scope.textboxmessage true no matter , bothered me. if if($scope.textboxmessage = "hi") true.

i'm not sure why case sense free comment if have suggestions.

this how solved it:

// edit post $scope.editme = function(message) { if($scope.newmessage == null){ $scope.textboxmessage = "here can edit post entering new message , pressing edit on affected post" + "\n \n" + "your post:" + "\n" + message.post; } else{ message.post = $scope.newmessage; list.$save(message); $scope.textboxmessage = chatmessage; $scope.newmessage = null; } }

angularjs firebase angularfire

Comments

Popular posts from this blog

java Multi query from Mysql using netbeans -

c# - DotNetZip fails with "stream does not support seek operations" -

c++ - StartServiceCtrlDispatcher don't can access 1063 error -