angularjs服务 $http
<!DOCTYPE html><html ng-app="test"><head><meta charset="utf-8"><script src="angular.min.js"></script><script>var app=angular.module(‘test‘,[]);// alert(app);app.controller(‘zhangsan‘,function($scope,$http){// $http.get(url,参数)// $http.post()// a.php?a=xxx&b=xxx=>$http.get(‘a.php‘,{params:{a:12,b:6},responseType:‘json‘}).then(function(res){alert(res.data+5);},function(){alert("失败了");});});</script></head><body ng-controller="zhangsan"></body></html>
a.php
<?phpecho $_GET[‘a‘]+$_GET[‘b‘];?>
angularjs服务 $http
原文地址:https://www.cnblogs.com/zzws/p/9113964.html