How to translate date in Angularjs datepicker?

I have a form and I am trying to pass a date using the http post directive and Angularjs datepicker. I am using the bootstrap user interface. When I pass the date to console.log I just see "" for the date. If you see anything that I am doing wrong or can be of any help, please let me know. I tried to use parent.dt too, but no luck. Thanks in advance.

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 directive

<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>

      

+3
angularjs datepicker


source to share


No one has answered this question yet

Check out similar questions:

4523
Thinking in AngularJS if I have a jQuery background?
3178
AngularJS: Service vs provider vs factory
1690
How does data binding work in AngularJS?
1195
How do I access the $ scope variable in the browser console using AngularJS?
1073
How to use $ scope. $ Watch and $ scope. $ Apply in AngularJS?
998
What is the difference between "@" and "=" in scope in AngularJS?
969
What are the nuances of the scope of prototype / prototypal inheritance in AngularJS?
912
'this' vs $ scope in AngularJS controllers
688
if else in AngularJS templates
557
AngularJS passes data to $ http.get request



All Articles
Loading...
X
Show
Funny
Dev
Pics