ngx-modialog
Version:
Modal / Dialog for Angular
61 lines (60 loc) • 1.82 kB
TypeScript
import { Observable } from 'rxjs';
import { ComponentRef } from '@angular/core';
import { Overlay, ModalOverlay } from '../overlay/index';
import { CloseGuard } from '../models/tokens';
/**
* API to an open modal window.
*/
export declare class DialogRef<T> {
overlay: Overlay;
context: T;
/**
* Reference to the overlay component ref.
*/
overlayRef: ComponentRef<ModalOverlay>;
/**
* States if the modal is inside a specific element.
*/
inElement: boolean;
destroyed: boolean;
/**
* Fired before dialog is destroyed.
* No need to unsubscribe, done automatically.
* Note: Always called.
* When called, overlayRef might or might not be destroyed.
*/
onDestroy: Observable<void>;
private _resultDeferred;
private _onDestroy;
private closeGuard;
constructor(overlay: Overlay, context?: T);
/**
* A Promise that is resolved on a close event and rejected on a dismiss event.
*/
readonly result: Promise<any>;
/**
* Set a close/dismiss guard
* @param g
*/
setCloseGuard(guard: CloseGuard): void;
/**
* Close the modal with a return value, i.e: result.
*/
close(result?: any): void;
/**
* Close the modal without a return value, i.e: cancelled.
* This call is automatically invoked when a user either:
* - Presses an exit keyboard key (if configured).
* - Clicks outside of the modal window (if configured).
* Usually, dismiss represent a Cancel button or a X button.
*/
dismiss(): void;
/**
* Gracefully close the overlay/dialog with a rejected result.
* Does not trigger canDestroy on the overlay.
*/
bailOut(): void;
destroy(): void;
private _destroy();
private _fireHook<T>(name);
}