UNPKG

3.66 kBTypeScriptView Raw
1import { ComponentRef } from '@angular/core';
2import { Observable } from 'rxjs';
3import { NgbModalBackdrop } from './modal-backdrop';
4import { NgbModalWindow } from './modal-window';
5import { ContentRef } from '../util/popup';
6/**
7 * A reference to the currently opened (active) modal.
8 *
9 * Instances of this class can be injected into your component passed as modal content.
10 * So you can `.close()` or `.dismiss()` the modal window from your component.
11 */
12export declare class NgbActiveModal {
13 /**
14 * Closes the modal with an optional `result` value.
15 *
16 * The `NgbModalRef.result` promise will be resolved with the provided value.
17 */
18 close(result?: any): void;
19 /**
20 * Dismisses the modal with an optional `reason` value.
21 *
22 * The `NgbModalRef.result` promise will be rejected with the provided value.
23 */
24 dismiss(reason?: any): void;
25}
26/**
27 * A reference to the newly opened modal returned by the `NgbModal.open()` method.
28 */
29export declare class NgbModalRef {
30 private _windowCmptRef;
31 private _contentRef;
32 private _backdropCmptRef?;
33 private _beforeDismiss?;
34 private _closed;
35 private _dismissed;
36 private _hidden;
37 private _resolve;
38 private _reject;
39 /**
40 * The instance of a component used for the modal content.
41 *
42 * When a `TemplateRef` is used as the content or when the modal is closed, will return `undefined`.
43 */
44 get componentInstance(): any;
45 /**
46 * The promise that is resolved when the modal is closed and rejected when the modal is dismissed.
47 */
48 result: Promise<any>;
49 /**
50 * The observable that emits when the modal is closed via the `.close()` method.
51 *
52 * It will emit the result passed to the `.close()` method.
53 *
54 * @since 8.0.0
55 */
56 get closed(): Observable<any>;
57 /**
58 * The observable that emits when the modal is dismissed via the `.dismiss()` method.
59 *
60 * It will emit the reason passed to the `.dismissed()` method by the user, or one of the internal
61 * reasons like backdrop click or ESC key press.
62 *
63 * @since 8.0.0
64 */
65 get dismissed(): Observable<any>;
66 /**
67 * The observable that emits when both modal window and backdrop are closed and animations were finished.
68 * At this point modal and backdrop elements will be removed from the DOM tree.
69 *
70 * This observable will be completed after emitting.
71 *
72 * @since 8.0.0
73 */
74 get hidden(): Observable<void>;
75 /**
76 * The observable that emits when modal is fully visible and animation was finished.
77 * Modal DOM element is always available synchronously after calling 'modal.open()' service.
78 *
79 * This observable will be completed after emitting.
80 * It will not emit, if modal is closed before open animation is finished.
81 *
82 * @since 8.0.0
83 */
84 get shown(): Observable<void>;
85 constructor(_windowCmptRef: ComponentRef<NgbModalWindow>, _contentRef: ContentRef, _backdropCmptRef?: ComponentRef<NgbModalBackdrop> | undefined, _beforeDismiss?: Function | undefined);
86 /**
87 * Closes the modal with an optional `result` value.
88 *
89 * The `NgbMobalRef.result` promise will be resolved with the provided value.
90 */
91 close(result?: any): void;
92 private _dismiss;
93 /**
94 * Dismisses the modal with an optional `reason` value.
95 *
96 * The `NgbModalRef.result` promise will be rejected with the provided value.
97 */
98 dismiss(reason?: any): void;
99 private _removeModalElements;
100}