27.简单的get请求

<!DOCTYPE html>
<html ng-app="myApp" >
<head lang="en">
<meta charset="UTF-8">
<title>HTTP-GET</title>
<script src="js/angular.js" type="text/javascript"></script>

</head>
<body>
<div ng-controller="myCtrl">
<div>{{result}}</div>
<button ng-click="send()">请求</button>
</div>

</body>

<script type="text/javascript">
var app=angular.module("myApp",[]);
app.controller("myCtrl",["$scope","$http",function ($scope,$http) {
$scope.result="";
$scope.send= function () {
$http.get("data/get.php")
.success(function (data,status,headers,config) {
$scope.result=data;
})
}

}])

</script>

</html>
原文地址:https://www.cnblogs.com/mx2036/p/6879259.html