angular-datepicker
angular-datepicker copied to clipboard
date-change doesn't work at all
Callback inside my controller:
functionToFire() { console.log('Yo!'); }
Template:
<div
date-picker
ng-model = "$ctrl.scheduleDate"
min-date = "$ctrl.today"
view = "date"
min-view = "date"
max-view = "date"
date-change = "$ctrl.functionToFire"
>
</div>
I tried on-set-date either but w/o success. Using Angular 1.5, date-picker is inside component.
Actually, because this directive uses it's own scope, ng-change is not available too.
any solution ?
any solution ?
Nope :/
— Regards, Piotr.
Somebody know, which version I can take where this function is work ?
You can watch the model or set up an ng-click on date-picker. It's not pretty but does the job. With ng-click you can sort of assume that date change came from user clicking on the picker.
Will this critical issue be fixed? Or package not maintained any more?
Has this ever been fixed? for me its not firering at all either..
Someone has fixed it ?
I have had a look at this problem, and while I was able to get the callback firing without any changes to the library, there appears to be a scoping issue. The called function scope is not the component controller, but is instead the datepicker scope.
See this plunkr for an illustration of the problem. Note that while the callback function fires, the text doesn't update because in the called function this
refers to the wrong object.
Here is a copy of the above plunkr with the issue fixed in the library. Note that when the callback is fired, this
now refers to the correct object.
I will make a PR with this fix when I get a chance.
When I downloaded this script from the site instead of using the NPM version it started working..
@ro8in what script and site ?
I meand this datepicker module.. When I take the NPM version it doesnt work but I download the latest from github it works.
Hi, sorry to bump an old issue, but was there a workaround for this? I want the ability to allow the user to type in a date and update the UI automatically like the live demo, but I seem to be suffering from the issue referenced above because of scoping issues.
Using "angular-datepicker": "^1.0.5" on npm if it helps.