I am trying to write edit functionality in angularjs. It almost has done. But the value is not updated in view part. Can anyone help? My code is given below Am using ng-repeat="book in books"
Html
<li ng-click="delegate.editPost()">Edit</li>
<div ng-show="showEditPost">
<div ng-click="delegate.savePost()">Save</div>
<p ng-if="showEditPost==false">{{book.text}}</p>
<div ng-if="showEditPost == true">
<textarea >{{edit.text}}</textarea>
</div>
</div>
controller
editPost:function(){
$scope.showEditPost=true;
$scope.edit=angular.copy($scope.books);
},
save:function(){
var Obj = {
text: $scope.edit.text
}
editService.edit( Obj,this.onSuccess, this.onFailure);
},
onSuccess:function(){
$scope.showEditPost=false;
angular.copy($scope.edit,$scope.books);
}
ng-repeatin your html