$http is a core service in AngularJS, used to read data from remote servers.

AngularJS XMLHttpRequest syntax

$http is a core service in AngularJS, used to read data from remote servers.

AngularJS XMLHttpRequest example

// 简单的 GET 请求,可以改为 POST $http({ method: 'GET', url: '/someUrl' }).then(function successCallback(response) { // 请求成功执行代码 }, function errorCallback(response) { // 请求失败执行代码 });