UNPKG

ngx-modal-ease

Version:

ngx-modal-ease is a versatile Angular library providing a lightweight, simple, and performant modal. This library supports data communication between components, opening of multiple modals, custom animations, and a range of customisable options.

68 lines (67 loc) 2.1 kB
import { ApplicationRef, EnvironmentInjector, Type } from '@angular/core'; import { ModalComponent } from './modal.component'; import { ModalResponse, Options } from './modal-options'; import * as i0 from "@angular/core"; export declare class ModalService { private appRef; private injector; private newModalComponent; private newComponent; /** * Internal use only. */ options: Options | undefined; /** * Internal use only. */ modalInstances: ModalComponent[]; /** * Internal use only. */ layerLevel: number; /** * Internal use only. */ closedOnClickOrEscape: boolean; private isBrowser; private promiseContainer; constructor(appRef: ApplicationRef, injector: EnvironmentInjector, platformId: Object); /** * Opens a custom component within a modal. * @param componentToCreate The custom component to display within the modal. * @param options Additional options for configuring the modal appearance and animations. * @returns A Promise that will emit custom data on closing the modal. * ``` * this.modalService.open(ModalContentComponent, { * modal: { * enter: 'enter-scale-down 0.1s ease-out', * leave: 'fade-out 0.5s', * }, * overlay: { * leave: 'fade-out 0.3s', * }, * data: { * type: 'Angular modal library', * }, * }) * .then((dataFromComponent) => { * ... * }); * ``` */ open<C>(componentToCreate: Type<C>, options?: Options): Promise<ModalResponse>; private openComponent; private instantiateProps; /** * Close the current modal. * @param data The optional data to emit on closing the modal (communication from modal to caller). */ close(data?: unknown): any; /** * Close all modal instances. * Respective animations will be applied. */ closeAll(): void; static ɵfac: i0.ɵɵFactoryDeclaration<ModalService, never>; static ɵprov: i0.ɵɵInjectableDeclaration<ModalService>; }