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
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
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
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.
NavigationService — the URL to return to after sign-in
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
Cross-cutting utilities
Loose functions with no search-specific meaning — building a query from the current route, reading route metadata, running code in a Web Worker, and a fetch wrapper with baseline error handling.
Default query name resolver
An Angular route resolver that supplies the application's default query name to a route with no explicit one.