Is it possible to dynamically change the text on a submit button while data is being saved in a form?
Here's an example of the button:
<button ng-click="save()">Save data</button>
I have updated my save function based on some suggestions I received:
$scope.ButtonText = "Save day";
$scope.save=function(){
$scope.ButtonText = "Saving day";
for(var i=0;i<days.length;i++)
{
MyService.saveday()
.success(function(data, status, headers, config) {
})
.error(function(data, status, headers, config) {
});
}
$scope.ButtonText = "Save day";
};
During the process of saving data, I would like the text on the button to switch from "Save data" to "Saving data" and then back to "Save data" once all data has been saved.
UPDATE
I initially added
$scope.ButtonText = "Save day";
following some responses, but I realized that my situation is more complex as I make multiple asynchronous service calls. So my question now is how can I update the text while these async calls are being made, and only revert it back after they are all complete.
Thanks,
Thomas