src/notification/notification-display.service.ts
Methods |
constructor(applicationRef: ApplicationRef)
|
||||||
Parameters :
|
close | ||||||
close(notificationRef: any)
|
||||||
Programatically closes notification based on
Parameters :
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);
}
}
}