Angular In development

The nabd-angular package: screen names from the Router, errors and slowness automatically.

Not available yet. These examples show the planned API; package and function names may change before the first release.

Install

bash
npm install nabd-browser nabd-angular

Setup

src/app/nabd.config.ts
import { NabdOptions } from 'nabd-angular';

export const nabdOptions: NabdOptions = {
  orgToken: 'nb_pub_…',
  appName: 'My Portal',
  environment: 'production',
  consentRequired: true,
};

standalone (from Angular 15)

src/main.ts
import { provideNabd } from 'nabd-angular';

bootstrapApplication(AppComponent, {
  providers: [
    provideRouter(routes),
    provideHttpClient(),
    provideNabd(nabdOptions),
  ],
});

NgModule (from Angular 13)

src/app/app.module.ts
import { provideNabd } from 'nabd-angular';

@NgModule({
  imports: [BrowserModule, HttpClientModule, RouterModule.forRoot(routes)],
  providers: [provideNabd(nabdOptions)],
  bootstrap: [AppComponent],
})
export class AppModule {}

provideNabd calls Nabd.init itself. No interceptor needed: HttpClient requests are measured directly in the browser.

consent-banner.component.ts
import { Nabd } from 'nabd-browser';

accept(): void {
  Nabd.setConsent(true);
}

Screen names

The name is the route pattern (invoices/:id/edit), so there are no numbers or identifiers, and it works with useHash. For a custom name:

app.routes.ts
{ path: 'invoices/new', component: InvoiceCreateComponent,
  data: { nabdScreen: 'invoice_create' } }

Events

typescript
Nabd.trackEvent('taskCompleted', { screen: 'invoice_create' });
Nabd.setUserRef(userRefFromServer); // after sign-in, without the token itself

Errors

Errors that reach the ErrorHandler are recorded (type and fingerprint only), and your custom handler keeps working. HttpErrorResponse is not counted twice: the network failure is already recorded by measuring the request.

The package reads no headers, request bodies or full URLs. For the rest of the API, options and tap detection limits see the JavaScript page.