Use AngularJS wrappers

Fixes #54 by using $window and $document