File

src/notification/notification-display.service.ts

Index

Methods

Constructor

constructor(applicationRef: ApplicationRef)
Parameters :
Name Type Optional
applicationRef ApplicationRef No

Methods

close
close(notificationRef: any)

Programatically closes notification based on notificationRef. *

Parameters :
Name Type Optional
notificationRef any No
Returns : void
import {
	Injectable,
	ApplicationRef
} from "@angular/core";

@Injectable()
export class NotificationDisplayService {
	constructor(protected applicationRef: ApplicationRef) {}

	/**
	 * Programatically closes notification based on `notificationRef`.	 *
	 */
	close(notificationRef: any) {
		if (notificationRef.hostView) {
			setTimeout( () => {
				this.applicationRef.detachView(notificationRef.hostView);
				notificationRef.destroy();
			}, 200);
		}
	}
}

results matching ""

    No results matching ""