I have ApiController class that includes multiple GET methods.

    //method 1   
    public IEnumerable<Drive> GetProducts()
    {
                  ...
    }

    //method2
    public IEnumerable<string> GetCustomer(string name)
    {
                  ...
    }

    //method3
    public IEnumerable<string> GetCustomers()
    {
                  ...
    }

This is my angularjs script

var app = angular.module("MyApp", []);
app.controller("MyController", function ($scope, $http) {
    $http.get('http://localhost:53551/api/values/GetProducts').
        success(function (data, status, headers, config) {
            $scope.strings = data;
        }).
        error(function (data, status, headers, config) {
            alert("sa");
        });
    debugger;
    $scope.open = function (name) {
        debugger;
        $http.get('http://localhost:53551/api/values/GetCustomer?' + name ).
            success(function (data, status, headers, config) {
                $scope.strings = data;
            })
    };
    });

All functions only call GetProducts(). But I want to call each time a specific one. Is it possible to call specific GET method through angularjs from ApiControler?

Related posts

Recent Viewed