-
Notifications
You must be signed in to change notification settings - Fork 0
/
$http.js
22 lines (21 loc) · 905 Bytes
/
$http.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
var app = angular.module('mymodule', []);
app.controller('tablecontroller', function($scope, $http,$log) {
$http({
method : "GET",
url : "http://www.tutorialspoint.com/json/data.json"
}).then(function sucessHandler(response) {
$scope.myWelcome = response.data;
}, function errorHandler(response) {
$scope.myWelcome = response.statusText;
});
// second Ajax call for unordered List
$http({
method : "GET",
url : "https://www.w3schools.com/angular/customers.php"
}).then(function sucessHandler(response) {
$scope.info = response.data.records;
$log.info(response); // object in console
}, function errorHandler(response) {
$scope.myWelcome = response.statusText;
});
});