Useless dependencies removed, relative offsets added, and a full running example.

It's not exactly compatible with the original affix plugin - I don't change the class directly, but a variable in the scope.
I think this is more "angular"-like than changing the class and saving the last "affixed" variable.

Please have a look at example.html .