Я думаю, что ваш cancel
должен быть таким
cancel: function(value) {
$scope.showEdit = false;
$scope[value] = false;
$scope.editText = null;
},
Рабочий пример здесь
angular.module("app", []).controller("text", [
"$scope",
function($scope) {
$scope.text = "test"
$scope.showEdit = false;
$scope.Contents = {
text: "teeeeeeeeeest"
};
$scope.editText = '';
$scope.modules = {
edit: function(value) {
$scope.showEdit = true;
$scope[value] = true;
$scope.editText = angular.copy($scope.Contents);
},
cancel: function(value) {
$scope.showEdit = false;
$scope[value] = false;
$scope.editText = null;
},
save: function(value) {
$scope.Contents = angular.copy($scope.editText);
$scope.showEdit = false;
$scope.editText = null;
$scope[value] = false;
},
onSuccessEdit: function(data) {
$scope.showEdit = false;
$scope.content.text = data;
},
onFailureEdit: function(data) {
$scope.showEdit = true;
}
};
}
]);
<div ng-app="app">
<div ng-controller="text">
<button ng-click="modules.edit('edit')">edit</button>
<div ng-show="showEdit">
<button ng-click="modules.save('edit')">save</button>
<button ng-click="modules.cancel('edit')">cancel</button>
</div>
<p ng-if="!showEdit">{{content.text}}</p>
<textarea ng-if="showEdit" ng-model="editText.text">
</textarea> Original Text: {{Contents.text}} <br> Editer Text: {{editText.text}}
</div>
</div>