The Angular framework consists of several core packages published to npm that provide the fundamental infrastructure for building applications:
@angular/core: The primary runtime framework, including the component model, dependency injection (DI), change detection, and the signals-based reactivity system packages/core/package.json2-4@angular/common: Provides standard directives (NgIf, NgFor), pipes, and the HttpClient for network communication packages/common/package.json2-4@angular/compiler: The low-level engine for parsing templates and expressions and generating executable code packages/compiler/package.json2-4@angular/compiler-cli: The ahead-of-time (AOT) compiler (known as ngtsc) that integrates with the TypeScript compiler to transform decorators into runtime instructions packages/compiler-cli/package.json2-4Sources: packages/core/package.json2-4 packages/common/package.json2-4 packages/compiler/package.json2-4 packages/compiler-cli/package.json2-4
The framework is organized as a hierarchy where the compiler and core form the base, and feature packages build upon them.
The @angular/compiler-cli package acts as a consumer of both the @angular/compiler and the typescript compiler packages/compiler-cli/package.json32-49 At runtime, @angular/core maintains a peer dependency on @angular/compiler for JIT compilation scenarios packages/core/package.json26-33
Sources: packages/compiler-cli/package.json32-49 packages/core/package.json25-33
The @angular/core package is the heart of the framework. It defines the application lifecycle, manages the component tree, and implements the reactivity system.
The core package defines a comprehensive set of runtime error codes in RuntimeErrorCode to provide detailed debugging information packages/core/src/errors.ts31-161 Errors are formatted using the NG0 prefix followed by the absolute value of the error code packages/core/src/errors.ts188-193
| Error Category | Code Range | Examples |
|---|---|---|
| Change Detection | 100-199 | EXPRESSION_CHANGED_AFTER_CHECKED (-100) |
| Dependency Injection | 200-299 | CYCLIC_DI_DEPENDENCY (-200), PROVIDER_NOT_FOUND (-201) |
| Template/Directives | 300-399 | MULTIPLE_COMPONENTS_MATCH (-300), DUPLICATE_DIRECTIVE (309) |
| Hydration | 500-599 | HYDRATION_NODE_MISMATCH (-500) |
| Signals | 600-699 | SIGNAL_WRITE_FROM_ILLEGAL_CONTEXT (600) |
Sources: packages/core/src/errors.ts31-161 packages/core/src/errors.ts188-193 goldens/public-api/core/errors.api.md21-210
The ViewContainerRef class is the primary API for dynamic view manipulation, allowing the creation of host views via createComponent() and embedded views via createEmbeddedView() packages/core/src/linker/view_container_ref.ts132-194
Sources: packages/core/src/linker/view_container_ref.ts84-194
The @angular/common package contains tools used in most applications but are not part of the framework's core runtime logic.
The CommonModule exports the standard library of Angular templates goldens/public-api/common/index.api.md109-116:
NgIf packages/common/src/directives/ng_if.ts NgForOf packages/common/src/directives/ng_for_of.ts174-177 and NgSwitch packages/common/src/directives/ng_switch.ts120 Note that these are deprecated in favor of @if, @for, and @switch blocks packages/common/src/directives/ng_for_of.ts30-32AsyncPipe goldens/public-api/common/index.api.md50 DatePipe goldens/public-api/common/index.api.md140 CurrencyPipe goldens/public-api/common/index.api.md119 and JsonPipe.The NgSwitch directive uses SwitchView to manage the creation and destruction of templates within a ViewContainerRef packages/common/src/directives/ng_switch.ts22-47 It tracks matches and updates default cases if no NgSwitchCase matches the current value packages/common/src/directives/ng_switch.ts148-158
Sources: goldens/public-api/common/index.api.md50-152 packages/common/src/directives/ng_switch.ts22-168 packages/common/src/directives/ng_for_of.ts30-32
These packages handle the transformation of Angular's declarative syntax into optimized imperative code.
ngtsc is the primary entry point for the AOT compiler, provided as the ngc binary packages/compiler-cli/package.json6-7 It also includes tools for internationalization message extraction via ng-xi18n packages/compiler-cli/package.json8
The @angular/localize package provides tools for localizing messages, including CLI tools for translation, extraction, and migration packages/localize/package.json5-9 It depends on @angular/compiler for processing i18n tags in templates packages/localize/package.json40-43
Sources: packages/compiler-cli/package.json6-9 packages/localize/package.json5-9 packages/localize/package.json40-43
Angular supports dynamic creation of bindings through the inputBinding and outputBinding functions packages/core/src/render3/dynamic_bindings.ts133-181
Input bindings track update state via bindingUpdated packages/core/src/render3/dynamic_bindings.ts83 If the value changes, the compiler-generated setDirectiveInput is called to update the directive instance packages/core/src/render3/dynamic_bindings.ts100
Sources: packages/core/src/render3/dynamic_bindings.ts80-157
Refresh this wiki