UNPKG

@progress/kendo-angular-notification

Version:

Kendo UI Notification for Angular

74 lines (73 loc) 2.87 kB
/**----------------------------------------------------------------------------------------- * Copyright © 2025 Progress Software Corporation. All rights reserved. * Licensed under commercial license. See LICENSE.md in the project root for more information *-------------------------------------------------------------------------------------------*/ import { ComponentFactoryResolver, Injector, InjectionToken, ElementRef } from '@angular/core'; import { NotificationSettings } from '../models/notification-settings'; import { NotificationRef } from '../models/notification-ref'; import * as i0 from "@angular/core"; /** * Injects the Notification container. When not provided, uses the first root component of * the application. * * > Use `NOTIFICATION_CONTAINER` only with the [`NotificationService`]({% slug api_notification_notificationservice %}) class. * * @example * * ```ts * import { NgModule, ElementRef } from '@angular/core'; * import { BrowserModule } from '@angular/platform-browser'; * import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'; * * import { NotificationModule, NOTIFICATION_CONTAINER } from '@progress/kendo-angular-notification'; * import { AppComponent } from './app.component'; * * @NgModule({ * declarations: [AppComponent], * imports: [BrowserModule, NotificationModule], * bootstrap: [AppComponent], * providers: [ * { * provide: NOTIFICATION_CONTAINER, * useFactory: () => ({ nativeElement: document.body } as ElementRef) * } * ] * }) * export class AppModule {} * * platformBrowserDynamic().bootstrapModule(AppModule); * ``` */ export declare const NOTIFICATION_CONTAINER: InjectionToken<ElementRef<any>>; /** * A service for opening Notification components dynamically * ([see example]({% slug overview_notification %})). * * @export * @class NotificationService */ export declare class NotificationService { private resolver; private injector; private container; private notificationContainers; private position; private applicationRef; /** * @hidden */ constructor(resolver: ComponentFactoryResolver, injector: Injector, container: ElementRef); /** * Opens a Notification component. Created Notifications are mounted * in the DOM directly in the root application component. * * @param {NotificationSettings} settings - The settings which define the Notification. * * @returns {NotificationRef} - A reference to the Notification object and the convenience properties. */ show(settings: NotificationSettings): NotificationRef; private get appRef(); private findGroupContainer; static ɵfac: i0.ɵɵFactoryDeclaration<NotificationService, [null, null, { optional: true; }]>; static ɵprov: i0.ɵɵInjectableDeclaration<NotificationService>; }