using $window instead of window when accessing the angular global