查看页面:
<div ng-controller="LoginCtrl">
<form name="login_form" ng-submit="submit()" >
Email: <input type="email" ng-model="login.email" required/><br />
Password: <input type="password" ng-model="login.pass" required/><br />
<input type="submit" />
</form>
main.js
function LoginCtrl($scope, $http) {
$scope.login = {};
$scope.submit = function(){
$http({
method: 'POST',
url: '/login',
data: $scope.login,
headers: {'Content-Type': 'application/x-www-form-urlencoded'}
}).
success(function(response) {
window.location.href = "/login";
}).
error(function(response) {
$scope.codeStatus = response || "Request failed";
});
}
登录控制器:
if ($request->isPost()) {
$data = json_decode(file_get_contents("php://input"));}
我需要从角度表单中获取数据并将其传递给 zend 控制器并执行登录检查并提交表单。有人可以帮助逐步解释吗?