harm-less / angular-sticky

Pure javascript AngularJS directive to make elements stick when scrolling
http://harm-less.github.io/angular-sticky
83 stars 38 forks source link

use-placeholder false is incorrectly processed #12

Closed lagivan closed 8 years ago

lagivan commented 8 years ago

I've noticed a bug with use-placeholder option. Neither of the following variants lead to usePlaceholder option to be false:

<div hl-sticky use-placeholder="false">
<div hl-sticky use-placeholder="{{false}}">

Instead options.usePlaceholder is equal to string value "false" that is evaluated as true in the code. It results in creating placeholder always independently of the option value.

harm-less commented 8 years ago

Thanks for pointing this out because it wasn't just usePlaceholder that couldn't be assigned with a scope variable or evaluated whatsoever. I just spend a great part of my precious Sunday writing tests, but they had to be written anyway and I'd probably found the bug myself. Just goes to show again that unit tests are invaluable.

I've made a new patch (0.2.4) you can start using right away if you still like to.