Forums - C# Corner

Forum guidelines
Austin Mudadi

Austin Mudadi

  • 1.4k
  • 73
  • 6.2k

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 (!$ {
alert("Enter name");
server.request('PostgresSQLtest', {
name: $,
surname: $scope.surname,
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)