Hi skp,
Check this example. Now please take its reference and correct your code.
HTML
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.7.8/angular.min.js"></script>
<script type="text/javascript">
var app = angular.module('MyApp', []);
app.controller("MyController", function ($scope, $http) {
$scope.btntext = "Submit";
$scope.isDisabled = false;
$scope.submit = function () {
$http.post("Default.aspx/AddInvoiceDetails", { headers: { 'Content-Type': 'application/json'} })
.then(function (respone) {
if (respone.data.d == 1) {
alert("Submitted");
$scope.isDisabled = true;
}
}, function error(response) {
alert(response.data);
});
}
});
</script>
<div ng-app="MyApp" ng-controller="MyController">
<input type="button" value="{{btntext}}" ng-click="submit()" ng-disabled="isDisabled" />
</div>
Code
C#
[System.Web.Services.WebMethod]
public static int AddInvoiceDetails()
{
return 1;
}
VB.Net
<System.Web.Services.WebMethod>
Public Shared Function AddInvoiceDetails() As Integer
Return 1
End Function
Screenshot