User Interaction
To specify when the Popover should be shown and hidden, set the showEvent and hideEvent properties. These properties can accept several events at once as well as an object.
- <img id="image" src="https://url/to/an/image" />
- <dx-popover
- target="#image"
- showEvent="dxhoverstart"
- hideEvent="dxhoverend">
- <div *dxTemplate="let data of 'content'">
- <p>Popover content</p>
- </div>
- </dx-popover>
- import { DxPopoverModule } from "devextreme-angular";
- // ...
- export class AppComponent {
- // ...
- }
- @NgModule({
- imports: [
- // ...
- DxPopoverModule
- ],
- // ...
- })
The Popover can also be hidden when a user clicks outside it. To control this behavior of the Popover, use the hideOnOutsideClick property.
- <img id="image" src="https://url/to/an/image" />
- <dx-popover
- target="#image"
- showEvent="dxhoverstart"
- hideEvent="dxhoverend"
- [hideOnOutsideClick]="false">
- <div *dxTemplate="let data of 'content'">
- <p>Popover content</p>
- </div>
- </dx-popover>
- import { DxPopoverModule } from "devextreme-angular";
- // ...
- export class AppComponent {
- // ...
- }
- @NgModule({
- imports: [
- // ...
- DxPopoverModule
- ],
- // ...
- })
API
To show or hide the Popover programmatically, bind the visible property of Popover to a component property. After that, change the latter property, and the Popover will appear or disappear.
- <img id="image" src="https://url/to/an/image" />
- <dx-popover
- target="#image"
- [visible]="isPopoverVisible">
- <div *dxTemplate="let data of 'content'">
- <p>Popover content</p>
- </div>
- </dx-popover>
- <dx-button
- text="Show the Popover"
- (onClick)="isPopoverVisible = true">
- </dx-button>
- <dx-button
- text="Hide the Popover"
- (onClick)="isPopoverVisible = false">
- </dx-button>
- import { DxPopoverModule, DxButtonModule } from "devextreme-angular";
- // ...
- export class AppComponent {
- isPopoverVisible: boolean = false;
- }
- @NgModule({
- imports: [
- // ...
- DxPopoverModule
- ],
- // ...
- })
Events
To execute certain commands before or after the Popover was shown/hidden, handle the showing, shown, hiding or hidden event. If the event handling function is not going to be changed during the lifetime of the UI component, assign it to the corresponding onEventName property when you configure the UI component.
- <dx-popover ...
- (onShowing)="onShowing($event)"
- (onShown)="onShown($event)"
- (onHiding)="onHiding($event)"
- (onHidden)="onHidden($event)">
- </dx-popover>
- import { DxPopoverModule } from "devextreme-angular";
- // ...
- export class AppComponent {
- onShowing (e) {
- // Handler of the "showing" event
- },
- onShown (e) {
- // Handler of the "shown" event
- },
- onHiding (e) {
- // Handler of the "hiding" event
- },
- onHidden (e) {
- // Handler of the "hidden" event
- }
- }
- @NgModule({
- imports: [
- // ...
- DxPopoverModule
- ],
- // ...
- })
See Also
If you have technical questions, please create a support ticket in the DevExpress Support Center.