Added fix for #6 by @DiegoPires.

http://plnkr.co/edit/rp38lx