InterviewHubPRO
Section Overview
Q82

Question 82 of 283

Part 4: JIT vs AOT Compilation, Metadata & TypeScript (76 - 100)

29%
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,

  1. Write expression syntax with in the supported range of javascript features
  2. The compiler can only reference symbols which are exported
  3. Only call the functions supported by the compiler
  4. 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.