I am using Angular-Pikaday directive, Selecting and retrieving date works fine. The value in pikaday input element changes properly when selected from pikaday datepicker.
I want to change value in the pikaday input element via code ie from controller on some action.
I have tried assigning ng-model, it changes value but it is not recognized by pikaday datepicker.
Link to Plunker
How can i change value in pikaday input element.
Thanks,
You can call setDate
method on the objected passed to pikaday
config.
var app = angular.module('plunker', ['pikaday']);
app.controller('MainCtrl', function($scope) {
$scope.startDate = '11/18/2015';
$scope.changeDate = function() {
$scope.startDate.setDate('11/15/2015');
}
});
The above code will work.