I am trying to update my angular model using a known working webmethod (.net).
I get data back from my webmethod logged to the console successfully.
It updates the text-box value as well.
But this doesn't update my angular model binding.
What am I doing wrong?
HTML
<input class="txtCalls" ng-model="TotalCalls"/>
Angular
$scope.TotalCalls;
CodeBehind
[WebMethod]
[ScriptMethod(UseHttpGet = true]
public static string GetCallData()
{
String Calls = "34";
return Calls;
}
Ajax Call
$(document).ready(function () {
$('.btn-primary').click(function () {
$.ajax({
type: "GET",
url: "Stats.aspx/GetCallData",
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function (response) {
$('.txtCalls').text(response.d);
console.log(response.d);
},
failure: function (response) {
alert(response.d);
console.log(response.d);
}
});
});