angular-ui / bootstrap

PLEASE READ THE PROJECT STATUS BELOW. Native AngularJS (Angular) directives for Bootstrap. Smaller footprint (20kB gzipped), no 3rd party JS dependencies (jQuery, bootstrap JS) required. Please read the README.md file before submitting an issue!
http://angular-ui.github.io/bootstrap/
MIT License
14.28k stars 6.73k forks source link

Datepicker silently fails on invalid attribute property setting #4601

Open Steveb-p opened 9 years ago

Steveb-p commented 9 years ago

Plunker: http://plnkr.co/edit/NP0qnFIke9gYO3wL928j?p=preview When invalid max-mode is set on popup, it fails silently. When the same is done on inline element, then it depends on whether variable name would be a valid setting. If it is, it works without complaining about using proper expression there ('day' for example?).

Would it be a problem if datepicker instead complain about it in the log or throw errors? It was a rather hard bug to catch in my own code. All datepicker did was complain about non-existing elements in https://github.com/angular-ui/bootstrap/blob/2fc3f2147bece57401e5a836cf4a80e8821f7d9a/src/datepicker/datepicker.js#L179

icfantv commented 9 years ago

I think this is a reasonable request but shouldn't be limited to just the max-mode field. That said, this is going to be a REALLY low priority for us given our current focus.

If you would like to take a stab at it, we welcome PRs with tests.

wesleycho commented 9 years ago

Probably $log.error would be ideal - this is a good issue, we should look to address this.

If you want to take a stab at a PR, it shouldn't be too bad to implement (with tests).

Steveb-p commented 9 years ago

I'll take a crack on it in the spare time, just don't want to make any promises that I might not be able to keep ;)

icfantv commented 9 years ago

@JakeFalcor - that's a noble quest indeed. the comments on issues are littered with broken promises. ;-)