Angular SDK
The @notifizz/angular package provides a standalone component and injectable services to embed the Notifizz Notification Center in your Angular application.
Installation
npm install @notifizz/angular
NotifizzAngularComponent
A standalone Angular component that renders the bell icon and notification center. Use the notifizz-bell selector in your template.
Basic usage
import { Component } from "@angular/core" ;
import { NotifizzAngularComponent } from "@notifizz/angular" ;
@ Component ({
selector: "app-root" ,
standalone: true ,
imports: [ NotifizzAngularComponent ],
template: `
<notifizz-bell
[options]="notifizzOptions"
(ready)="onReady()"
(stateChange)="onStateChange($event)"
></notifizz-bell>
` ,
})
export class AppComponent {
notifizzOptions = {
apiKey: "YOUR_FRONT_API_KEY" ,
authType: "backendToken" as const ,
token: "TOKEN_FROM_BACKEND" ,
userId: "user_42" ,
userEmail: "alice@example.com" ,
position: "top-right" as const ,
};
onReady () {
console . log ( "Notifizz is ready!" );
}
onStateChange ( state : any ) {
console . log ( "Unread:" , state . unreadCount );
}
}
Input Type Required Default Description optionsNotifizzOptionsYes — Authentication and display options. mountIdstringNo "notifizz-notifications"DOM element ID for the widget mount point.
Outputs
Output Type Description readyEventEmitter<void>Emitted when the widget is ready. stateChangeEventEmitter<NotifizzState>Emitted on every state change.
Reactive state
The component exposes a state$ observable:
@ ViewChild ( NotifizzAngularComponent ) notifizzComponent ! : NotifizzAngularComponent ;
ngAfterViewInit () {
this . notifizzComponent . state$ . subscribe (( state ) => {
console . log ( "Unread:" , state . unreadCount );
});
}
NotifizzOptions
Option Type Required Default Description apiKeystringYes — Your Front API Key. authType'firebase' | 'backendToken' | 'none'Yes — Authentication strategy. tokenstringConditional — Required for firebase and backendToken. userIdstringConditional — Required for backendToken and none. userEmailstringConditional — Required for backendToken and none. positionNotifizzPositionNo — Bell position. notificationCenterStyles{ marginTop?: string }No — Notification center style overrides. bellStyles{ marginRight?: string; marginLeft?: string }No — Bell style overrides. serverUrlstringNo "https://widget.notifizz.com"Widget server URL. apiUrlstringNo "https://eu.api.notifizz.com/v1"API base URL. widgetPathstringNo "/v1/widget.js"Widget script path.
Custom bell icon
Replace the default bell using Angular content projection. Use the #customBellIcon template reference:
< notifizz-bell [options] = "notifizzOptions" >
< svg
#customBellIcon
xmlns = "http://www.w3.org/2000/svg"
width = "24"
height = "24"
fill = "none"
stroke = "currentColor"
stroke-width = "2"
stroke-linecap = "round"
stroke-linejoin = "round"
>
< path d = "M18 8a6 6 0 0 0-12 0c0 7-3 9-3 9h18s-3-2-3-9" ></ path >
< path d = "M13.73 21a2 2 0 0 1-3.46 0" ></ path >
</ svg >
</ notifizz-bell >
You can use any HTML element or Angular component — just add the #customBellIcon reference.
NotifizzService
An injectable service for programmatic control of the notification center. Use this when you need to interact with the widget from anywhere in your application, not just from the template.
import { Component } from "@angular/core" ;
import { NotifizzService } from "@notifizz/angular" ;
@ Component ({
selector: "app-header" ,
template: `
<button (click)="notifizz.toggle()">
Notifications ({{ (notifizz.state$ | async)?.unreadCount }})
</button>
` ,
})
export class HeaderComponent {
constructor ( public notifizz : NotifizzService ) {}
}
Properties
Property Type Description state$Observable<NotifizzState>RxJS observable of the widget state. isReadybooleanWhether the widget is ready (getter). isOpenbooleanWhether the notification center is open (getter). unreadCountnumberCurrent unread count (getter).
Methods
Method Returns Description init(options, mountId?)voidInitialize the widget programmatically. getState()NotifizzStateGet a copy of the current state. open()voidOpen the notification center. close()voidClose the notification center. toggle()voidToggle the notification center. onReady(cb)() => voidRegister a ready callback. Returns unsubscribe function. onStateChange(cb)() => voidRegister a state change callback. Returns unsubscribe function. destroy()voidClean up the widget and all listeners.
Programmatic initialization
If you prefer to initialize the widget from a service rather than the template:
@ Component ({
selector: "app-root" ,
template: `<div id="notifizz-mount"></div>` ,
})
export class AppComponent implements OnInit , OnDestroy {
constructor ( private notifizz : NotifizzService ) {}
ngOnInit () {
this . notifizz . init (
{
apiKey: "YOUR_FRONT_API_KEY" ,
authType: "backendToken" ,
token: "TOKEN_FROM_BACKEND" ,
userId: "user_42" ,
userEmail: "alice@example.com" ,
},
"notifizz-mount"
);
}
ngOnDestroy () {
this . notifizz . destroy ();
}
}
Other services
The services below are used internally by NotifizzService. You typically don’t need them unless you are building advanced integrations or custom state management.
NotifizzStateService
Manages the internal state. Useful if you need fine-grained control over state updates.
Property/Method Type Description state$Observable<NotifizzState>State observable (BehaviorSubject). isReadybooleanGetter. isOpenbooleanGetter. unreadCountnumberGetter. getState()NotifizzStateGet state copy. onReady(cb)() => voidRegister ready callback. onStateChange(cb)() => voidRegister state change callback. destroy()voidClean up.
NotifizzCommandService
Sends commands to the widget. Used internally by NotifizzService.
Method Description open()Open the notification center. close()Close the notification center. toggle()Toggle the notification center. send(command, ...args)Send an arbitrary command to the widget.
Exported types
The following types can be imported from @notifizz/angular:
Type Description NotifizzStateWidget state object (isReady, isOpen, unreadCount, lastUpdated, hasError?, errorCode?). NotifizzPositionPosition union: 'top-right', 'top-left', 'bottom-right', 'bottom-left'. NotifizzBellContextBell context with state + controls (unreadCount, isOpen, isReady, toggle, open, close). NotifizzOptionsOptions passed to the component or NotifizzService.init(). NotifizzConfigInternal configuration (apiKey, apiUrl, serverUrl, widgetPath). AuthOptionsAuthentication fields (apiKey, authType, token?, userId?, userEmail?).
Next steps
Frontend quickstart Get started with a complete example in under 5 minutes.
Shared concepts Positioning, styling, state model, and widget lifecycle.