SSR and lifecycle
What the server renders and who owns browser resources.
Server and hydration
The server produces real SVG and the original-data table. Angular owns and hydrates those static nodes, then mounts one interactive owner on a separate surface and hides the retained static projection. Server geometry is not replaced with opaque HTML. WordCloud needs real measurements through planningPorts; this showcase measures SVG getBBox during local preparation.
import { Component, input } from '@angular/core';
import { NeuralChart, type ChartData } from '@neural-charts/angular';
@Component({
selector: 'app-ssr-chart',
imports: [NeuralChart],
template: '<nc-chart [data]="data()" [instanceId]="instanceId()" />',
})
export class SsrChart {
readonly data = input.required<ChartData>();
readonly instanceId = input.required<string>();
}Angular integration
NeuralChart uses typed inputs, signals, OnPush and domain outputs. Zone.js is unnecessary. Core does not depend on Angular and the adapter does not recalculate geometry.
Destruction
Angular releases listeners, the ResizeObserver and pending render work through DestroyRef when the component is destroyed.
instanceId
Keep it stable and unique within the document. Changing it identifies a new instance. Avoid random IDs during SSR or data reconstruction.
| Situation | What to do |
|---|---|
| Two charts on a page | Use two different, stable instanceIds. |
| Server rendering | Retain the same ID; avoid Math.random and Date.now. |
| Remove a component | The adapter releases the chart resources. |