Angular & Signals (283 Qs)•Part 4: JIT vs AOT Compilation, Metadata & TypeScript (76 - 100)
What are the restrictions of metadata?
In Angular, You must write metadata with the following general constraints,
- Write expression syntax with in the supported range of javascript features
- The compiler can only reference symbols which are exported
- Only call the functions supported by the compiler
- Decorated and data-bound class members must be public.
Practical Code Example
text
// Metadata Restrictions in AOT:
// Decorator metadata must be statically analyzable at build time.
// Private properties, arrow functions, or dynamic runtime variables cannot be used in decorator metadata.