@ng-bootstrap/ng-bootstrap
Version:
Angular powered Bootstrap
116 lines (115 loc) • 4.01 kB
TypeScript
import { ComponentRef } from '@angular/core';
import { Observable } from 'rxjs';
import { NgbModalBackdrop } from './modal-backdrop';
import { NgbModalWindow } from './modal-window';
import { NgbModalUpdatableOptions } from './modal-config';
import { ContentRef } from '../util/popup';
/**
* A reference to the currently opened (active) modal.
*
* Instances of this class can be injected into your component passed as modal content.
* So you can `.update()`, `.close()` or `.dismiss()` the modal window from your component.
*/
export declare class NgbActiveModal {
/**
* Updates options of an opened modal.
*
* @since 14.2.0
*/
update(options: NgbModalUpdatableOptions): void;
/**
* Closes the modal with an optional `result` value.
*
* The `NgbModalRef.result` promise will be resolved with the provided value.
*/
close(result?: any): void;
/**
* Dismisses the modal with an optional `reason` value.
*
* The `NgbModalRef.result` promise will be rejected with the provided value.
*/
dismiss(reason?: any): void;
}
/**
* A reference to the newly opened modal returned by the `NgbModal.open()` method.
*/
export declare class NgbModalRef {
private _windowCmptRef;
private _contentRef;
private _backdropCmptRef?;
private _beforeDismiss?;
private _closed;
private _dismissed;
private _hidden;
private _resolve;
private _reject;
private _applyWindowOptions;
private _applyBackdropOptions;
/**
* Updates options of an opened modal.
*
* @since 14.2.0
*/
update(options: NgbModalUpdatableOptions): void;
/**
* The instance of a component used for the modal content.
*
* When a `TemplateRef` is used as the content or when the modal is closed, will return `undefined`.
*/
get componentInstance(): any;
/**
* The promise that is resolved when the modal is closed and rejected when the modal is dismissed.
*/
result: Promise<any>;
/**
* The observable that emits when the modal is closed via the `.close()` method.
*
* It will emit the result passed to the `.close()` method.
*
* @since 8.0.0
*/
get closed(): Observable<any>;
/**
* The observable that emits when the modal is dismissed via the `.dismiss()` method.
*
* It will emit the reason passed to the `.dismissed()` method by the user, or one of the internal
* reasons like backdrop click or ESC key press.
*
* @since 8.0.0
*/
get dismissed(): Observable<any>;
/**
* The observable that emits when both modal window and backdrop are closed and animations were finished.
* At this point modal and backdrop elements will be removed from the DOM tree.
*
* This observable will be completed after emitting.
*
* @since 8.0.0
*/
get hidden(): Observable<void>;
/**
* The observable that emits when modal is fully visible and animation was finished.
* Modal DOM element is always available synchronously after calling 'modal.open()' service.
*
* This observable will be completed after emitting.
* It will not emit, if modal is closed before open animation is finished.
*
* @since 8.0.0
*/
get shown(): Observable<void>;
constructor(_windowCmptRef: ComponentRef<NgbModalWindow>, _contentRef: ContentRef, _backdropCmptRef?: ComponentRef<NgbModalBackdrop> | undefined, _beforeDismiss?: (() => boolean | Promise<boolean>) | undefined);
/**
* Closes the modal with an optional `result` value.
*
* The `NgbMobalRef.result` promise will be resolved with the provided value.
*/
close(result?: any): void;
private _dismiss;
/**
* Dismisses the modal with an optional `reason` value.
*
* The `NgbModalRef.result` promise will be rejected with the provided value.
*/
dismiss(reason?: any): void;
private _removeModalElements;
}