@anglr/notifications
Version:
Angular module for displaying notifications
52 lines • 2.84 kB
JavaScript
import { Attribute, Directive, inject } from '@angular/core';
import { NOTIFICATIONS } from '@anglr/common';
import { LOCAL_NOTIFICATIONS_SCOPE_NAME, LocalNotificationsService } from '../../common/notifications.service';
import * as i0 from "@angular/core";
/**
* Directive used for providing local notifications service to local notifications
*/
export class LocalNotificationsProviderDirective {
//######################### constructor #########################
constructor(name) {
if (name) {
this.name = name;
}
}
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.0", ngImport: i0, type: LocalNotificationsProviderDirective, deps: [{ token: 'withProvider', attribute: true }], target: i0.ɵɵFactoryTarget.Directive }); }
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.1.0", type: LocalNotificationsProviderDirective, isStandalone: true, selector: "notifications[withProvider]", providers: [
{
provide: LocalNotificationsService,
useFactory: () => {
const self = inject(LocalNotificationsProviderDirective, { self: true });
const notifications = inject(NOTIFICATIONS);
if (self.name) {
return notifications.getScope(`${LOCAL_NOTIFICATIONS_SCOPE_NAME}-${self.name}`);
}
return notifications.getScope(LOCAL_NOTIFICATIONS_SCOPE_NAME);
},
},
], ngImport: i0 }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.0", ngImport: i0, type: LocalNotificationsProviderDirective, decorators: [{
type: Directive,
args: [{
selector: 'notifications[withProvider]',
providers: [
{
provide: LocalNotificationsService,
useFactory: () => {
const self = inject(LocalNotificationsProviderDirective, { self: true });
const notifications = inject(NOTIFICATIONS);
if (self.name) {
return notifications.getScope(`${LOCAL_NOTIFICATIONS_SCOPE_NAME}-${self.name}`);
}
return notifications.getScope(LOCAL_NOTIFICATIONS_SCOPE_NAME);
},
},
],
}]
}], ctorParameters: () => [{ type: undefined, decorators: [{
type: Attribute,
args: ['withProvider']
}] }] });
//# sourceMappingURL=localNotificationsWithProvider.directive.js.map