โค้ด: เลือกทั้งหมด
.delete()
.get()
.head()
.jsonp()
.patch()
.post()
.put()
http://www.w3schools.com/angular/angular_http.asp
ตัวอย่าง
โค้ด: เลือกทั้งหมด
<!DOCTYPE html>
<html>
<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular.min.js"></script>
<body>
<div ng-app="myApp" ng-controller="mainCtrl">
<h1>{{myWelcome}}</h1>
</div>
<script>
var app = angular.module('myApp', []);
app.controller('mainCtrl', function($scope, $http) {
$http({
method : "GET",
url : "data_show.html"
}).then(function mySucces(response) {
$scope.myWelcome = response.data;
}, function myError(response) {
$scope.myWelcome = response.statusText;
});
});
</script>
</body>
</html>
ตัวอย่างการ Run
ดูเพิ่มเติมที่นี่
https://docs.angularjs.org/api/ng/service/$http
สามารถศึกษา เพิ่มเติมได้ที่
บทเรียน HTML
บทเรียน-html5
บทเรียน CSS
บทเรียน Javascript
บทเรียน jquery