when i click CheckAvailability button date value doesnot pass to controller
Forget ASP. In AngularJS input doesn't need a value. Simply populate the ng-model
. You can do it in controller or with ng-init
in HTML. To mask/filter the date, use $filter
service. It's usually not used directly, so I suggest applying a filter in ng-init
. AngularJS has a date
filter for this purpose.
Here is an example:
var app = angular.module('myApp', []);
app.controller('myCtrl', function($scope) {
$scope.now = new Date();
$scope.CheckAvailability = function() {
console.log("Date:", $scope.BookedFromDate);
};
});
Alternatively change the type from text
to date
to completely ignore the filter and masking.
var app = angular.module('myApp', []);
app.controller('myCtrl', function($scope) {
$scope.BookedFromDate = new Date();
$scope.CheckAvailability = function() {
console.log("Date:", $scope.BookedFromDate);
};
});