Angularjs 尝试通过Appgyver/Angular js发布时,服务器没有响应
我对使用Appgyver比较陌生,在尝试使用POST连接到远程服务器时遇到了一些问题。我不确定问题是否来自服务器端,因为在发布成功/失败时设置的警报没有出现。下面是我的代码片段 Index.htmlAngularjs 尝试通过Appgyver/Angular js发布时,服务器没有响应,angularjs,appgyver,Angularjs,Appgyver,我对使用Appgyver比较陌生,在尝试使用POST连接到远程服务器时遇到了一些问题。我不确定问题是否来自服务器端,因为在发布成功/失败时设置的警报没有出现。下面是我的代码片段 Index.html <div ng-controller="IndexController"> <super-navbar> <super-navbar-title> Index </super-navbar-title> </
<div ng-controller="IndexController">
<super-navbar>
<super-navbar-title>
Index
</super-navbar-title>
</super-navbar>
<div class="padding">
<input type="text" ng-model="username" placeholder="Username">
<input type="text" ng-model="password" placeholder="Password">
<button class="button button-block button-positive" ng-click="getPosition()">Log in</button>
</ul>
</div>
</div>
我的服务器上的php文件中使用的标题为:
header("Access-Control-Allow-Origin: *");
header('Access-Control-Allow-Headers: X-PINGOTHER');
header("Access-Control-Max-Age: 2520");
header("Access-Control-Allow-Methods: GET, POST, OPTIONS, PUT, DELETE, XMODIFY");
现在开始工作,结果是需要包含$http的函数参数。更新代码后,所有操作都正常工作。更新后的代码应为:
.controller('IndexController',function($scope,超音速,$http){您是否确实检查了开发人员工具以查看其行为?Chrome和FF内置了这些工具,检查您的应用程序是否创建了网络请求以及它获得了什么状态代码。谢谢,完全忘记了开发工具,$http给出了一个问题。现在全部排序。
header("Access-Control-Allow-Origin: *");
header('Access-Control-Allow-Headers: X-PINGOTHER');
header("Access-Control-Max-Age: 2520");
header("Access-Control-Allow-Methods: GET, POST, OPTIONS, PUT, DELETE, XMODIFY");