The ng-controller is a directive to control the AngularJS Application.
The {{ content }} bind the content variable.
The {{ statuscode }} bind the statuscode variable.
The {{ statustext }} bind the statustext variable.
The “httpCtrl” used to create the controller for the Application with arguments $scope object and $http service.
The $http is a service and it is used to call the get method, this http get request will get the content from the “wikitechy.html” as response.
The .then condition used to check the response if the file has been retrieved successfully then call the mySuccess function otherwise that will be call the myError function.
The data is used to get the response data.
The status is used to get the response status code.
The statusText is used to get the response status as text.
The myError function is executed on error Callback which is used to execute the block of statements on error while the load the file.
Sample Output for $http Service in AngularJS:
The output displays content of “wikitechy.html”.
Status code : 200 this is a success status code for $http service request.
Status Text : OK is specify the success status of $http service request.
Sample Output for $http Service Error in AngularJS:
The output displays the error message. This error message shows if any error occurs during the file loading process.
angular http get paramshttp get exampleangularjs http get json example$http is not definedhttp.get node$http.get angularjs exampleangularjs http get params arrayangularjs get request parametersangular get params$http.get exampleangularjs http get multiple parameters$http.post multiple parametersangularjs http post multiple objectsangularjs http post form dataangularjs pass parameters to controllerhow to use $http.post in angularjsangular http post headersangularjs http post not sending dataangularjs http post paramsangularjs post request parameterspost multiple parameters jqueryangularjs post dataangularjs post multipart/form-dataangularjs post form data jsonangularjs $http post form data exampleangularjs formdata objectangularjs post exampleangularjs http post json exampleangularjs http post example with parametersangularjs tutorials