view page:
<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";
});
}
LoginController:
if ($request->isPost()) {
$data = json_decode(file_get_contents("php://input"));}
i need to fetch data from angular form and pass it to zend controller and perform login check and submit form.Could anybody help with step by step explanation?