I'm trying to set the open-to date in a the bootstrap-datepicker in AngularJS without filling a field with the a set defaultdate value. I only want to change the date which the datepicker opens to. Is there any way to do this?
1 Answers
3
votes
The angular ui bootstrap datepicker is bound to a model. You need to set the ng-model statement to the date you want it to open to. So if the datepicker is bound to
$scope.date = new Date();
but you want it to open 10/10/2010 instead, you can change the model to
$scope.date = new Date(2010, 10, 10);
If you want to change the default behavior and not have it bound to a model that would involve changing the actual code of the angular ui bootstrap datepicker which is entirely possible but it's easier to just change the value it is bound to.