ng-window-*

Handler for window events

Description

The ng-window-* directive allows you to specify custom behavior for events dispatched from Window object. The event name is defined by including it in the placeholder of directive’s name. Example: ng-window-online will bind the directive to the online event. For a full list of standard options, see events.

Parameters


ng-window-*

  • Type: Expression

  • Description: Expression to evaluate upon event dispatch. Event object is available as $event.

  • Example:

    <div ng-window-message="data = $event.message.date">{{ data }}</div>
    

Demo

<section ng-app>
  Try disabling your network connection
  <div ng-window-online="online = true">Connected: {{ online }}</div>
  <div ng-window-offline="offline = true">Disconnected: {{ offline }}</div>
</section>
Try disabling your network connection
Connected: {{ online }}
Disconnected: {{ offline }}