angular-datepicker
angular-datepicker copied to clipboard
Using set kills the datepicker
If I set any property after I have created the date picker, none of the buttons work afterwards.
I have found the same. It seems we need to refresh the live events.
Here is a simplified example to reproduce the problem:
<html ng-app="testApp">
<head>
<link rel="stylesheet" href="css/libs/classic.css">
<link rel="stylesheet" href="css/libs/classic.date.css">
<link rel="stylesheet" href="css/libs/classic.time.css">
</head>
<body ng-controller="AppCtrl">
<input type="text" pick-a-date="target.finishdate" placeholder="Commit to this date"/>
<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.2.18/angular.min.js"></script>
<script src="js/libs/picker.js"></script>
<script src="js/libs/picker.date.js"></script>
<script src="js/libs/picker.time.js"></script>
<script src="js/libs/legacy.js"></script>
<script src="js/libs/directives.js"></script>
<script>
var app = angular.module('testApp', ['angular-datepicker']);
app.controller('AppCtrl', function($scope) {
$scope.target = {finishdate: new Date(),
scheduled: ''};
$scope.dateOptions = {};
$scope.timeOptions = {};
});
</script>
</body>
</html>
When the model for pick-a-date is set through angular or javascript, we are not calling the function attachLiveEvents() of prepareElementRoot() as the datepicker does when you click on a date. I made a quick fix by adding a refreshLiveEvents() function to the element, setting it in prepareElementRoot() and calling it as part of the angular code that sets the date in directives.js. This works for me yet I have not thought through how this could be cleanly solved.
Yeah, this really is a show stopper for me....
Is there any news how to fix this properly yet?
@sysupbda any chance you could post your fix? Cheers
Sure, but honestly I would have to learn how to do that.
On 25 September 2014 10:25, Ray Viljoen [email protected] wrote:
@sysupbda https://github.com/sysupbda any chance you could post your fix? Cheers
— Reply to this email directly or view it on GitHub https://github.com/alongubkin/angular-datepicker/issues/3#issuecomment-56788391 .
You can fork the code, make your changes in it and push it into the forked repo. So you can share the link with us. Or if it is done within your app,share the releant part of the code as a gist maybe?
Hi, I have now forked the repo and made the relevant changes. Please let me know if it works for you. I am really late on my own project so I don't have a chance to test what I uploaded.
https://github.com/sysupbda/angular-datepicker/tree/master/src
Hy sysupbda, thanks for sharing. Is there anything else required other than using your version of the code? I have it installed but still seeing unresponsive buttons.
Let me check tonight (in 6 hours or so) and let you know. Might have skipped something?
On 29 September 2014 12:37, Paul Slugocki [email protected] wrote:
Hy sysupbda, thanks for sharing. Is there anything else required other than using your version of the code? I have it installed but still seeing unresponsive buttons.
— Reply to this email directly or view it on GitHub https://github.com/alongubkin/angular-datepicker/issues/3#issuecomment-57143239 .
Sorry I did not come back to you earlier. For me it does work. However I should certainly have made sure I made clear that you can't use the minified version in my fork. I made the changes I described to the non minified version. Sorry for the likely misunderstanding.
Nice fix - works great!
Fixes the default value when set, freezing bug.
Additionally it fixed a bug in IE mobile where it did not remove the underlying screen when it draws the calendar...