Austin Muts

Austin Muts

  • 1.1k
  • 329
  • 125.5k

How to call a c# method using angularJS

Oct 6 2017 5:02 AM
I have a server side method like  which use C# 
[ HttpPost]
public void PostgresSQLtest(JObject data)
{
string firstname = data.Value<string>("name");
string surname = data.Value<string>("surname");
string email = data.Value<string>("email");
int telephone = data.Value<int>("phone");
 
 
I want to pass parameters to  PostgresSQLtest(JObject data) from the client side which uses angularjs and here is the method
app.controller('pages/regtest.html', function ($scope, $cordovaCamera, $window, server) {
$scope.register = function () {
if (!$scope.name) {
alert("Enter name");
return;
}
server.request('PostgresSQLtest', {
name: $scope.name,
surname: $scope.surname,
email: $scope.email,
phone: $scope.telephone,
});
};
});
 
BUT i seem unable to pass parameters from client side to server side method.Server.request seem not to connect to  PostgresSQLtest() method in the server side.Can someone HELP!
 
 

Answers (1)