I am facing an issue with the Angular Material datepicker where it does not select the date I choose. Instead, in my AngularJS controller, I always get the sysdate even if I select another date. Can anyone help me figure out what I am doing wrong?
Here is my controller code:
angular.module('MyApp')
.controller('MyController', ['$scope', 'growl',
'modalService', 'moment',
'$uibModal', '$log',
function ($scope, growl, modalService,
moment, $uibModal, $log) {
$scope.initDate = new Date();
$scope.printDate = function() {
console.log($scope.initDate);
}
}]);
And here is my view code:
<md-datepicker ng-model="initDate" md-placeholder="Select a date"
ng-change="printDate()"
md-min-date="minDate"
md-date-filter="disabledWeekend">
</md-datepicker>