如何在Angularjs datepicker中传递日期?

时间:2015-06-18 13:31:55

标签: angularjs datepicker

我有一个表单,我正在尝试使用http post和Angularjs datepicker指令传递日期。我正在使用引导UI。当我在console.log中传递日期时,我只是看到""为了约会。如果你看到我做错了什么或者可以提供任何帮助,请告诉我。我也尝试过使用parent.dt,但没有运气。提前谢谢。

App.js

var postData={
            firstName:$scope.newUser.name,
            email:$scope.newUser.email,
            date: $scope.parent.dt,
            termsPhone: $scope.newUser.termsPhone,
            termsEmail: $scope.newUser.termsEmail,           
            telephone: $scope.newUser.phoneNumber
    };
    //postData=JSON.stringify(postData);
    $http({method:'POST',
            url:'sendmail.php',
            data:postData,
            headers: {'Content-Type': 'application/x-www-form-urlencoded;charset=utf-8'}})

        .success(function (data,status,headers,config) {

            console.log('Success: ' + data); 
            $scope.realDate = data;
            $scope.modalOpen = true;
            $scope.confirmation = true;
            $log.info($scope.newUser.dt);
            $log.info(postData);
        })
        .error(function (data, status,headers,config) {
            console.log('error' + status + data);
        });

Datepicker指令

<p class="input-group">
              <input type="text" class="form-control" datepicker-popup="" ng-model="$parent.dt" is-open="opened" min="minDate" max="'2015-06-22'" datepicker-options="dateOptions" date-disabled="disabled(date, mode)" ng-required="true" close-text="Close" date-type="string" />
              <span class="input-group-btn">
                <button class="btn btn-default" ng-click="open($event)"><i class="glyphicon glyphicon-calendar"></i></button>
              </span>
            </p>

0 个答案:

没有答案