I'm currently experimenting with the angular date picker directive. My goal is to retrieve the entered date value from the date picker and log it to the console. However, all of my attempts so far have been unsuccessful.
Here's a snippet of my code:
HTML:
<input class="form-control"
ng-model="ctrl.input"
ng-model-options="{ updateOn: 'blur' }"
placeholder="Select a date..."
moment-picker="ctrl.input" id='date'>
<button ng-model='ctrl.input' ng-click="onclick()">submit</button>
JS
angular
.module('Demo', ['moment-picker'])
.controller('DemoCtrl', ['$scope', function ($scope) {
$scope.onclick = function(){
console.log(angular.element(document).find('#date').val());
}
}]);