Sunday, September 17, 2017

How to write The http Service structure?

The http Service

The http service is one of the most common used services in Angular JS applications. The service makes a request to the server, and lets your application handle the response.

Example

Use the $http service to request data from the server:
var app = angular.module('myApp', []);
app.controller('myCtrl', function($scope, $http) {
    $http.get("welcome.htm").then(function (response) {
        $scope.myWelcome = response.data;
    });
});