fulup-bzh / DatePicker

Date Picker compatible with Zurb Foundation under Angular framework.
Other
11 stars 11 forks source link

Date selection on demo page broken. #1

Closed circlingthesun closed 9 years ago

circlingthesun commented 9 years ago

I can open the date picker but when I select a date nothing happens. I get 'Uncaught TypeError: Cannot read property '0' of undefined' on the demo page in Chrome 40. I would also expect that clicking away from the datepicker would close it.

circlingthesun commented 9 years ago

It looks nice though ;)

fulup-bzh commented 9 years ago

Good point, I developped under Firefox fox, I will investigate why it fails on Chrome

fulup-bzh commented 9 years ago

I pushed a correction it works on my Linux/Chrome config. It was a browser compatibility issue I hope my patch will fix the issue everywheren but Safary and IE might be the next one on the list.

For mouse event handler. To access clicked DOM element.

If they is a more standard way to access clicked dom element I'm open to proposals.

Hopefully this will fixe the issue for every Chrome users.

circlingthesun commented 9 years ago

Works for me :+1: I had a quick look at the codebase. If you include angular's $locale service you don't have to hardcode the month names and their local variants. Have a look here https://github.com/angular/angular.js/blob/master/src/ng/locale.js#L3.

You could also significantly simplify things by using ng-repeat in your templates. Ng-repeat makes the data you are iterating over available as a local variable in your templates. If you do something like ng-repeat="day in days" you can use ng-click="daySelected(day, $event)" to pass the selected day and the event to some function. You'll need a lot less lines of code that way.

I've only skimmed the code. Apologies if I misunderstood something.

fulup-bzh commented 9 years ago

For locale I agree with you. I ported a, existing code form a jquery module and did not take the time to sim it for locale. For ng-repleat it would require a complete rearchitecture of the code, I need to think about it.

fulup-bzh commented 9 years ago

Modification reported as working on Safari, Chrome, Firefox and Android. Still fail on IE-9