angular-window-events
Easy window event handling! Support focus
, blur
, show
, and hide
.
- Support for
$broadcast
ing of events. - A
windowState
service for tracking state and adding event handlers. - Support for
show
andhide
for browsers that support the W3C Page Visibility spec. - Support for IE9 and up. IE10 if you want
show
andhide
support.
Usage Example
angular
Quick Guide
Installation
$ npm install angular-window-events
Or download from master/release
Event Handling
windowState Service
Methods
Properties
windowStatehasVisibilitySupport // => booleanwindowStateisShowing // => booleanwindowStateisHidden // => booleanwindowStateisFocused // => booleanwindowStateisBlurred // => boolean
$scope.$on
You can also use the $scope.$on
method to attach event handlers. When using
$scope.$on
, the window events are broadcast under the following names:
windowBlur
windowFocus
windowHide
windowShow
$scope