Atomic Angular — Doc interne

Cross-cutting services

Registering your own route components, sending custom audit events, calling a JsonMethod plugin, and reading the route the user navigated away from.

ROUTE_COMPONENTS — registering components for dynamic routes

Registering the components bootstrapApp's route creation needs
app.config.ts
import { ApplicationConfig } from "@angular/core";
import { ROUTE_COMPONENTS } from "@sinequa/atomic-angular";
import { AllResultsComponent } from "./all-results.component";
import { SearchLayoutComponent } from "./search-layout.component";

export const appConfig: ApplicationConfig = {
  providers: [
    {
      provide: ROUTE_COMPONENTS,
      useValue: [
        { path: "search", component: SearchLayoutComponent, isRoot: true },
        { path: "all", component: AllResultsComponent },
      ],
    },
  ],
};

ApplicationService (injected internally by bootstrapApp when createRoutes: true) reads this token to know which component renders each tab of the query's tabSearch configuration, and which one is the root layout (isRoot: true) wrapping the whole search route.

AuditService — sending audit events by hand

A custom audit event on a user action
sample.component.ts
import { Component, inject } from "@angular/core";
import { AuditService } from "@sinequa/atomic-angular";

@Component({ selector: "sample-component", template: `` })
export class SampleComponent {
  private readonly audit = inject(AuditService);

  protected onExport() {
    this.audit.notify({ type: "Search_Export_Results" });
  }
}

notifyDocument(type, doc, resultOrId, parameters?, rfmParameters?) is the one most applications reach for directly — it also listens for the tab losing and regaining visibility right after the call, to notify a Navigation_Return event if the user opened the document and came back within a second. notify() is a no-op while the client reports no session (client.auth.isAuthenticated() is false).

JsonMethodPluginService — calling a JsonMethod plugin

Posting to a custom plugin
sample.component.ts
import { JsonMethodPluginService } from "@sinequa/atomic-angular";

private readonly plugin = inject(JsonMethodPluginService);

this.plugin.post("myPlugin", { someParam: "value" }).subscribe((result) => { /* ... */ });

post/get both call the client's own http transport (plugin/<method>) rather than Angular's HttpClient — a plugin call issued this way is already covered by the client's own request/response handling (interface language, audit metadata, 401 recovery), with nothing further to register.

Redirecting back where the user came from
sample.component.ts
import { NavigationService } from "@sinequa/atomic-angular";

private readonly navigation = inject(NavigationService);

// null while the current URL IS an authentication screen (login, logout, change-password) — never
// redirect a signed-in user back onto one of those.
const returnUrl = this.navigation.urlAfterNavigation;

navigationEnd$ is the lower-level piece underneath it — an Observable<NavigationEnd> that also notifies AuditService.notifyRouteChange() once per distinct route (query-parameter-only changes on the same route, which make up most of a search session, do not re-notify).

Options

Prop

Type

Pitfalls

On this page