modal-ref.d.ts 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. import { ComponentRef } from '@angular/core';
  2. import { NgbModalBackdrop } from './modal-backdrop';
  3. import { NgbModalWindow } from './modal-window';
  4. import { ContentRef } from '../util/popup';
  5. /**
  6. * A reference to the currently opened (active) modal.
  7. *
  8. * Instances of this class can be injected into your component passed as modal content.
  9. * So you can `.close()` or `.dismiss()` the modal window from your component.
  10. */
  11. export declare class NgbActiveModal {
  12. /**
  13. * Closes the modal with an optional `result` value.
  14. *
  15. * The `NgbMobalRef.result` promise will be resolved with the provided value.
  16. */
  17. close(result?: any): void;
  18. /**
  19. * Dismisses the modal with an optional `reason` value.
  20. *
  21. * The `NgbModalRef.result` promise will be rejected with the provided value.
  22. */
  23. dismiss(reason?: any): void;
  24. }
  25. /**
  26. * A reference to the newly opened modal returned by the `NgbModal.open()` method.
  27. */
  28. export declare class NgbModalRef {
  29. private _windowCmptRef;
  30. private _contentRef;
  31. private _backdropCmptRef?;
  32. private _beforeDismiss?;
  33. private _resolve;
  34. private _reject;
  35. /**
  36. * The instance of a component used for the modal content.
  37. *
  38. * When a `TemplateRef` is used as the content or when the modal is closed, will return `undefined`.
  39. */
  40. readonly componentInstance: any;
  41. /**
  42. * The promise that is resolved when the modal is closed and rejected when the modal is dismissed.
  43. */
  44. result: Promise<any>;
  45. constructor(_windowCmptRef: ComponentRef<NgbModalWindow>, _contentRef: ContentRef, _backdropCmptRef?: ComponentRef<NgbModalBackdrop>, _beforeDismiss?: Function);
  46. /**
  47. * Closes the modal with an optional `result` value.
  48. *
  49. * The `NgbMobalRef.result` promise will be resolved with the provided value.
  50. */
  51. close(result?: any): void;
  52. private _dismiss;
  53. /**
  54. * Dismisses the modal with an optional `reason` value.
  55. *
  56. * The `NgbModalRef.result` promise will be rejected with the provided value.
  57. */
  58. dismiss(reason?: any): void;
  59. private _removeModalElements;
  60. }