What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

iTechGuides is reader-supported. When you buy through links on our site, we may earn an affiliate commission. As an Amazon Associate I earn from qualifying purchases. Learn more

Angular NG1001 means an affected decorator received something other than an object literal as its argument. To fix it, put the metadata object directly inside the decorator call instead of passing a variable that holds the object.

What does Angular NG1001 mean?

NG1001 is Angular’s compiler error named “Argument Not Literal.” It applies when an affected decorator’s argument is not an object literal. Angular’s NG1001 guidance identifies the affected decorators as @NgModule, @Pipe, @Component, @Directive, and @Injectable.

For example, passing a variable that contains decorator metadata does not meet the documented requirement, even if that variable evaluates to an object. The object literal must appear directly as the decorator argument.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

How do you fix NG1001?

  1. Find the decorator named in the compiler diagnostic.

  2. Check whether its argument is a variable reference or another expression rather than an inline object literal.

  3. Move the metadata object into the decorator call, then rebuild and review any follow-on compiler diagnostics.

For example, change a variable-based call such as @NgModule(moduleDefinition) to an inline form such as @NgModule({ declarations: [AppComponent] }). Keep the metadata values your application needs; the important change is that the object literal itself is now the decorator argument.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Why does Angular require a literal in a decorator?

Angular says the restriction makes compiler metadata extraction faster. Its documentation describes the stricter requirement as an intentional Ivy change: Ivy compiles decorators by moving expressions into other locations in the class output. The Angular Error Encyclopedia lists NG1001 as a compiler error.

The cited Angular guidance does not specify a release boundary or establish that every non-literal expression behaves identically across all compiler and Angular versions. If inlining the object does not resolve the diagnostic, use the exact compiler message to check the decorator and argument it identifies.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.