如何从角度js中的formdata获取值

时间:2015-07-01 13:06:24

标签: php jquery angularjs

这是我的表格

<form>
<input class="text_box1" type="text" name="email" ng-model="forget.email" >
<button style="width:auto" class="sign_up" ng-click="doForget(forget)">Get a Password</button>
</form>

我的app.js内有

.when('/forget', {
                title: 'forget',
                templateUrl: 'resources/views/forget.php',
                controller: 'authCtrl'
            })

authCtrl控制器

$scope.doForget = function (customer) {
        Data.post('eloquent.php', {
            customer: customer
        }).then(function (results) {
            if (results == "1") 
            {
                $location.path('login');
            }
        });
    };

我打电话给eloquent.php

但是如何才能从forget.php获取电子邮件的价值并发送给eloquent.php

1 个答案:

答案 0 :(得分:1)

您可以通过

获取forgot.email的值

forgotemail = $scope.forgot.email;

然后将其存储在本地存储中并在那里检索

localStorage.setItem("forgotemail ", "forgotemail ");

然后通过

进行通话
$http.post('eloquent.php', {forgotmail: forgotmail}).then(function (results)
{
//your other code here
}