我正在用angularjs和laravel构建应用程序4.一切都很好但我现在只需要允许XHR请求.
这就是我在控制器开头所拥有的.但这种说法总是错误的.
if (!\Request::ajax())
{
return Response::json(array('halt'=>Request::ajax()));
};
Run Code Online (Sandbox Code Playgroud)
在角度我使用标准的$ http服务.
angular.module('APP')
.factory("API", ($http,$q,appClient,apiURL) ->
class FB
constructor:->
this.deferredData = $q.defer();
info: (reload)->
$http(
method: "get"
url: apiURL+'game/'+appClient+"/info"
).success((res)->
dostuff()
)
Run Code Online (Sandbox Code Playgroud)