API: Core
QzIdGenerator
Application-scoped generator for DOM ids.
Overview
Application-scoped generator for DOM ids.
A module-level counter is shared by every Angular application in the same JavaScript realm. In
SSR that is the whole server process, so each request would continue numbering where the previous
one stopped: the server HTML would differ between identical requests and from what the client
renders after hydration. This service is providedIn: 'root', so every application (every SSR
request) gets its own counters, and ids depend only on render order.
Counters are kept per prefix, so mounting an unrelated primitive never renumbers another one.
- Kind: Service
- Provided in:
root - Source: packages/core/src/id/id-generator.ts:15
Public methods
next
next(prefix: string): string
Returns <prefix>-<n> with n starting at 1 for each prefix within this application.
| Parameter | Type | Optional | Description |
|---|---|---|---|
prefix |
string |