node.js - How to get a date value from angularjs form -


html

<div align="center" ng-controller="formctrl">     <form name="form" ng-submit="submitform()" novalidate>         <input type="date" name="mydate" ng-model="mydate" value="mydate"/>     </form> </div> 

javascript

var app = angular.module('formexample', []); app.controller('formctrl', function ($scope, $http) {      $scope.mydate = new date(); }); 

app.js

app.post('/', function (req, res) {     var jtime = req.body.mydate;     console.log(jtime); }); 

here result(console.log) shows undefined. how date value angular js form.

implement $scope.submitform function making ajax post request using $http.post:

app.controller('formctrl', function ($scope, $http) {     $scope.submitform = function() {         $http.post('/', {mydate: $scope.mydate});     };      }); 

Comments

Popular posts from this blog

java - Plugin org.apache.maven.plugins:maven-install-plugin:2.4 or one of its dependencies could not be resolved -

Round ImageView Android -

How can I utilize Yahoo Weather API in android -