AutoDismissDirective class

A directive that publishes a (dismiss) event when a focus, click or mouseup event occurs outside of it.

Note: For MaterialExpansionPanel please consider using the dedicated directive MaterialExpansionPanelAutoDismiss.

Note: When popups close they automatically re-focus the trigger element which will call dismiss. In this case please follow best practice and set autoDismissable to be the visibility of the popup itself.

Example Usage:

<div>
  <div class="disclaimer" [class.visible]="disclaimerVisible"
       [autoDismissable]="disclaimerVisible"
       (dismiss)="disclaimerVisible = false">
    Some scary disclaimery text
  <div>
  <button (click)="disclaimerVisible = true">Confirm</button>
</div>
Annotations
  • @Directive(selector: '[autoDismissable]:not(material-expansionpanel)')

Constructors

AutoDismissDirective(HtmlElement element, NgZone _zone)

Properties

autoDismissable bool
Boolean indicating if the dismiss event be published.
getter/setter pair
dismiss Stream
Event which is published when a focus, mouseup, or click occurs outside of the element.
no setter
hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited