@westyx-nexus/sdk-angular. All read methods are synchronous (cache-backed); only the lifecycle methods touch the network.
Bootstrap
provideNexus(config)
Returns an EnvironmentProviders[] array suitable for the providers: [] array of an ApplicationConfig (standalone apps).
APP_INITIALIZER that performs the blocking initial sync and instantiates the singleton client.
NexusModule.forRoot(config)
Equivalent for NgModule-based apps:
injectNexus() and NEXUS_CLIENT
Two equivalent ways to get the singleton client inside a component or service:
NexusClient public surface
Configs
getConfig returns the raw decoded JSON value. getConfigAs<T> is a thin generic wrapper for callers who know the expected type and want it cast.
public-key clients only see configs where is_public: true.
Feature flags
getFlag returns the current boolean from the in-memory cache (synchronous, one-shot read).
getFlagSignal returns a reactive Angular Signal<boolean> that re-evaluates automatically after every cache refresh - both TTL polls and SSE push events. This is the recommended method for template bindings that should reflect live flag changes without manual subscription. (v0.6.1)
defaultValue (default false) when the key is absent.
AB Testing
Batch evaluation of AB-Testing flags against the Nexus backend. UnlikegetFlag, these methods always perform a fresh HTTP request - results are user-scoped and depend on per-call attributes, so they are intentionally not cached. (v0.3.0)
evaluateAB(keys, userId, attributes) - Observable variant
Observable that emits the flag-key -> boolean map exactly once and completes.
evaluateABPromise(keys, userId, attributes) - Promise variant
evaluateAB, exposed as a Promise for async/await call sites.
Error cases
Secrets
getSecret(...) throws NexusPublicKeyError synchronously. The method exists for API symmetry across SDKs; in practice you never invoke it from browser code.
Metadata
Sync / lifecycle
connectStream() automatically after the initial sync. Disconnect explicitly only if you want to stop receiving live updates without disposing the whole client.
subscribe() returns an unsubscribe function. The callback runs on the Angular zone (so signals / change detection work without ngZone.run() boilerplate).
