0

I have an app in AngularJS. There I have a table and it has 5 columns. first three columns contain text fields where user can fill the data and next two columns contain a submit and reset button. On the press event of the reset button I want to reset all the three models associated with the text fields. Please suggest.

2 Answers 2

1

Change the reset function to use angular.copy

$scope.reset = function () {
    $scope.datas = angular.copy($scope.initial);
};
Sign up to request clarification or add additional context in comments.

Comments

0

If your object is like

$scope.data = { column1:"asas", column2:"asas", column3:"asadas" };

You can don it in 2 way

1.<button ng-click="data = {};"></button>

2.<button ng-click="reset();"></button>

 $scope.reset = function(){
     delete $scope.data;
 }

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.