cancel edit in angular js using splice

cancel edit in angular js using splice  using -'javascript,angularjs'

I am using datagrid using data from listOfAttributes array. there is edit icon, on click on that again two buttons there.. save and cancel edit. I want if user click on cancel edit, updated data should be clear and previously data should again persist. I am using splice for add previous object, and delete current object at a same time but it doesn't work.

 $scope.edit = function(attribute) {
    angular.copy(attribute, $scope.copyAttr);

$ = function(attribute){
  // works fine;

 $scope.cancelEdit = function(attribute) { // doesn't work

    var indx = $scope.listOfAttributes.indexOf(attribute);

    $scope.listOfAttributes.splice(indx, 0, $scope.copyAttr);



asked Oct 13, 2015 by tejas lakhani
0 votes

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
Anti-spam verification:
To avoid this verification in future, please log in or register.