Submit form only once with JSAngular? Press several times
Is there a way for the end user to submit the form to the database only once, even if they click it multiple times? I am using Angular to handle my stuff, I tried some methods but they remove my POST and GET methods, who has any ideas to lead me in the right direction?
},
controller: function ($scope, $modalInstance) {
$scope.close = function () {
$modalInstance.close();
};
$scope.submitFeedback = function () {
$scope.feedback = {
FeedbackRating: $scope.score,
FeedbackSubject: $scope.subject,
FeedbackUpload: 'upload',
FeedbackDescription: $scope.description
};
+3
source to share
1 answer
How I do it:
$rootScope.isLoading = function () {
return $http.pendingRequests.length > 0;
}
and in your html:
<button type="submit" ng-disabled="isLoading()">
Basically what happens here is that your button is disabled immediately upon your request.
Make sure to add $ http depending on your controller.
+3
source to share