Skip to content Skip to sidebar Skip to footer

Clearing The Form Fields And Saving The Details In Angular JS

I have created a simple form using angular js. When the user enter their details and submit it the values will be saved in console, but the values remains in the field even after c

Solution 1:

Here is PLUNKER of your code...

you should use ng-click instead onClick...


Solution 2:

You could set a property on the model to the saved person and reference this object underneath the form:

Controller:

$scope.test = function(){

    // do whatever needs to be done to save the person

    $scope.savedPerson = $scope.person;
}

View:

<p>Saved person {{savedPerson.name}}</p>

Post a Comment for "Clearing The Form Fields And Saving The Details In Angular JS"