I have implemented AngularJS to handle form validation and submission. The submit button is configured as follows:
<button type="submit" ng-disabled="btn" ng-click="submit(settings.$valid)" class="btn btn-primary">
Submit
</button>
The button will be disabled if the form is invalid, and enabled once it becomes valid.
This is the code snippet in question:
$http.get("http://localhost:5000/settings").then(function(response){
$scope.numberOfRows = response.data.numberOfRows
console.log($scope.numberOfRows)
if($scope.numberOfRows==0 && $scope.settings.$valid == false ){
$scope.btn=true
}else if($scope.numberOfRows==0 && $scope.settings.$valid == true){
$scope.btn=false
}
if($scope.numberOfRows==1){
$scope.btn=true
}
})
My issue arises when numberOfRows equals 0 and the form is invalid, preventing me from submitting the form as desired.
However, upon successfully filling out the form and achieving a valid status, nothing seems to occur.
I am seeking assistance with this matter. Can you help me?