For More Videos Visit Our YouTube Channel
How To Pass Data To $http.get Request In AngularJS Here we consider how to pass data to $http.get request. We know how to pass data in POST method in AngularJS. But lets consider how does it work when $http.get is used. HTTP GET request can't contain data to be posted to the server. But we can add a query string to the request. angular.http provides an option for this purpose. It is params for passing data in $http.get request. In another way we can use params in $http.get as follows. Pass Data To $http.get Request In AngularJS - Example Lets start with one example here. First of all, on the Web.Config, include the following section inside System.Web. I have created one Web Service named "DataService.asmx". Inside this service, there is a method named GetData. This method have one input parameter named abcd of string data type. We must include [System.Web.Script.Services.ScriptService] on our Service. The output of this method is serialized as shown below. The following given is the Script Side code. Here we have used $Http.get. The result will be available on the $Http.get then section. Inside $Http.get then, we are binding this result to Scope Object names. On the HTML part, we shows the Scope Object value on View as follows. When we run the Application, we can get the result as follows. By this way we can Pass Data To $http.get Request In AngularJS.