@angular/core

package

Implements Angular's core functionality, low-level services, and utilities.

  • Defines the class infrastructure for components, view hierarchies, change detection, rendering, and event handling.

  • Defines the decorators that supply metadata and context for Angular constructs.

  • Defines infrastructure for dependency injection (DI), internationalization (i18n), and various testing and debugging facilities.

Entry points

Primary

@angular/core

Implements Angular's core functionality, low-level services, and utilities.

Secondary

@angular/core/testing

Primary entry point exports

NgModules

ApplicationModule

Configures the root injector for an app with providers of @angular/core dependencies that ApplicationRef needs to bootstrap components.

Classes

ApplicationInitStatus

A class that reflects the state of running APP_INITIALIZERs.

ChangeDetectorRef

Base class for Angular Views, provides change detection functionality. A change-detection tree collects all views that are to be checked for changes. Use the methods to add and remove views from the tree, initiate change-detection, and explicitly mark views as dirty, meaning that they have changed and need to be rerendered.

Compiler

Low-level service for running the angular compiler during runtime to create ComponentFactorys, which can later be used to create and render a Component instance.

CompilerFactory

A factory for creating a Compiler

ComponentFactory
ComponentFactoryResolver
ComponentRef

Represents a component created by a ComponentFactory. Provides access to the component instance and related objects, and provides the means of destroying the instance.

DefaultIterableDiffer

Deprecated: v4.0.0 - Should not be part of public API.

ElementRef

A wrapper around a native element inside of a View.

EmbeddedViewRef

Represents an Angular view in a view container. An embedded view can be referenced from a component other than the hosting component whose template defines it, or it can be defined independently by a TemplateRef.

ErrorHandler

Provides a hook for centralized exception handling.

EventEmitter

Use in directives and components to emit custom events synchronously or asynchronously, and register handlers for those events by subscribing to an instance.

InjectionToken

Creates a token that can be used in a DI Provider.

Injector

Concrete injectors implement this interface.

IterableDiffers

A repository of different iterable diffing strategies used by NgFor, NgClass, and others.

KeyValueDiffers

A repository of different Map diffing strategies used by NgClass, NgStyle, and others.

ModuleWithComponentFactories

Combination of NgModuleFactory and ComponentFactorys.

NgModuleFactory
NgModuleFactoryLoader

Used to load ng module factories.

NgModuleRef

Represents an instance of an NgModule created via a NgModuleFactory.

NgProbeToken

A token for third-party components that can register themselves with NgProbe.

NgZone

An injectable service for executing work inside or outside of the Angular zone.

Query

Base class for query metadata.

QueryList

An unmodifiable list of items that Angular keeps up to date when the state of the application changes.

ReflectiveInjector

Deprecated: from v5 - slow and brings in a lot of code, Use Injector.create instead.

A ReflectiveDependency injection container used for instantiating objects and resolving dependencies.

ReflectiveKey

Deprecated: No replacement

A unique object used for retrieving items from the ReflectiveInjector.

RenderComponentType

Deprecated: Use RendererType2 (and Renderer2) instead.

Renderer

Deprecated: Use the Renderer2 instead.

Renderer2

Extend this base class to implement custom rendering. By default, Angular renders a template into DOM. You can use custom rendering to intercept rendering calls, or to render to something other than DOM.

RendererFactory2

Creates and initializes a custom renderer that implements the Renderer2 base class.

ResolvedReflectiveFactory

An internal resolved representation of a factory function created by resolving Provider.

RootRenderer

Deprecated: Use RendererFactory2 instead.

Injectable service that provides a low-level interface for modifying the UI.

Sanitizer

Sanitizer is used by the views to sanitize potentially dangerous values.

SimpleChange

Represents a basic change from a previous to a new value.

SystemJsNgModuleLoader

NgModuleFactoryLoader that uses SystemJS to load NgModuleFactory

SystemJsNgModuleLoaderConfig

Configuration for SystemJsNgModuleLoader. token.

TemplateRef

Represents an embedded template that can be used to instantiate embedded views. To instantiate embedded views based on a template, use the ViewContainerRef method createEmbeddedView().

Testability

The Testability service provides testing hooks that can be accessed from the browser and by services such as Protractor. Each bootstrapped Angular application on the page will have an instance of Testability.

TestabilityRegistry

A global registry of Testability instances for specific elements.

Version

Represents the version of Angular

ViewContainerRef

Represents a container where one or more views can be attached to a component.

ViewRef

Represents an Angular view, specifically the host view that is defined by a component. Also serves as the base class that adds destroy methods for embedded views.

WrappedValue

Indicates that the result of a Pipe transformation has changed even though the reference has not changed.

Decorators

Attribute

Attribute decorator and metadata.

Component

Decorator that marks a class as an Angular component and provides configuration metadata that determines how the component should be processed, instantiated, and used at runtime.

ContentChild

Configures a content query.

ContentChildren

Configures a content query.

Directive

Marks a class as an Angular directive. You can define your own directives to attach custom behavior to elements in the DOM. The options provide configuration metadata that determines how the directive should be processed, instantiated and used at runtime.

Host

A parameter decorator on a view-provider parameter of a class constructor that tells the DI framework to resolve the view by checking injectors of child elements, and stop when reaching the host element of the current component.

HostBinding

Decorator that marks a DOM property as a host-binding property and supplies configuration metadata. Angular automatically checks host property bindings during change detection, and if a binding changes it updates the host element of the directive.

HostListener

Decorator that declares a DOM event to listen for, and provides a handler method to run when that event occurs.

Inject

A parameter decorator on a dependency parameter of a class constructor that specifies a custom provider of the dependency.

Injectable

Marks a class as available to Injector for creation.

Input

Decorator that marks a class field as an input property and supplies configuration metadata. The input property is bound to a DOM property in the template. During change detection, Angular automatically updates the data property with the DOM property's value.

NgModule

Decorator that marks a class as an NgModule and supplies configuration metadata.

Optional

A parameter decorator to be used on constructor parameters, which marks the parameter as being an optional dependency. The DI framework provides null if the dependency is not found.

Output

Decorator that marks a class field as an output property and supplies configuration metadata. The DOM property bound to the output property is automatically updated during change detection.

Pipe

Decorator that marks a class as pipe and supplies configuration metadata.

Self

A parameter decorator to be used on constructor parameters, which tells the DI framework to start dependency resolution from the local injector.

SkipSelf

A parameter decorator to be used on constructor parameters, which tells the DI framework to start dependency resolution from the parent injector. Resolution works upward through the injector hierarchy, so the local injector is not checked for a provider.

ViewChild

Property decorator that configures a view query. The change detector looks for the first element or the directive matching the selector in the view DOM. If the view DOM changes, and a new child matches the selector, the property is updated.

ViewChildren

Configures a view query.

Functions

asNativeElements
assertPlatform

Checks that there currently is a platform which contains the given token as a provider.

createInjector

Create a new Injector which is configured using a defType of InjectorType<any>s.

createPlatform

Creates a platform. Platforms have to be eagerly created via this function.

createPlatformFactory

Creates a factory for a platform

defineInjectable

Construct an InjectableDef which defines how a token will be constructed by the DI system, and in which injectors (if any) it will be available.

defineInjector

Construct an InjectorDef which configures an injector.

destroyPlatform

Destroy the existing platform.

enableProdMode

Disable Angular's development mode, which turns off assertions and other checks within the framework.

forwardRef

Allows to refer to references which are not yet defined.

getPlatform

Returns the current platform.

inject
isDevMode

Returns whether Angular is in development mode. After called once, the value is locked and won't change any more.

resolveForwardRef

Lazily retrieves the reference value from a forwardRef.

setTestabilityGetter

Set the GetTestability implementation used by the Angular testing framework.

Structures

AfterContentChecked

A lifecycle hook that is called after the default change detector has completed checking all content of a directive.

AfterContentInit

A lifecycle hook that is called after Angular has fully initialized all content of a directive. Define an ngAfterContentInit() method to handle any additional initialization tasks.

AfterViewChecked

A lifecycle hook that is called after the default change detector has completed checking a component's view for changes.

AfterViewInit

A lifecycle hook that is called after Angular has fully initialized a component's view. Define an ngAfterViewInit() method to handle any additional initialization tasks.

ApplicationRef

A reference to an Angular application running on a page.

ChangeDetectionStrategy

The strategy that the default change detector uses to detect changes. When set, takes effect the next time change detection is triggered.

ClassProvider

Configures the Injector to return an instance of useClass for a token.

CollectionChangeRecord

Deprecated: v4.0.0 - Use IterableChangeRecord instead.

ConstructorSansProvider

Configures the Injector to return an instance of a token.

DebugElement
DebugNode
DoBootstrap

Hook for manual bootstrapping of the application instead of using bootstrap array in @NgModule annotation.

DoCheck

A lifecycle hook that invokes a custom change-detection function for a directive, in addition to the check performed by the default change-detector.

ExistingProvider

Configures the Injector to return a value of another useExisting token.

FactoryProvider

Configures the Injector to return a value by invoking a useFactory function.

ForwardRefFn

An interface that a function passed into forwardRef has to implement.

GetTestability

Adapter interface for retrieving the Testability service associated for a particular context.

InjectFlags

Injection flags for DI.

InjectableType

A Type which has an InjectableDef static field.

InjectorType

A type which has an InjectorDef static field.

IterableChangeRecord

Record representing the item change information.

IterableChanges

An object describing the changes in the Iterable collection since last time IterableDiffer#diff() was invoked.

IterableDiffer

A strategy for tracking changes over time to an iterable. Used by NgForOf to respond to changes in an iterable by effecting equivalent changes in the DOM.

IterableDifferFactory

Provides a factory for IterableDiffer.

KeyValueChangeRecord

Record representing the item change information.

KeyValueChanges

An object describing the changes in the Map or {[k:string]: string} since last time KeyValueDiffer#diff() was invoked.

KeyValueDiffer

A differ that tracks changes made to an object over time.

KeyValueDifferFactory

Provides a factory for KeyValueDiffer.

MissingTranslationStrategy

Use this enum at bootstrap as an option of bootstrapModule to define the strategy that the compiler should use in case of missing translations:

  • Error: throw if you have missing translations.
  • Warning (default): show a warning in the console and/or shell.
  • Ignore: do nothing.
ModuleWithProviders

A wrapper around an NgModule that associates it with the providers.

OnChanges

A lifecycle hook that is called when any data-bound property of a directive changes. Define an ngOnChanges() method to handle the changes.

OnDestroy

A lifecycle hook that is called when a directive, pipe, or service is destroyed. Use for any custom cleanup that needs to occur when the instance is destroyed.

OnInit

A lifecycle hook that is called after Angular has initialized all data-bound properties of a directive. Define an ngOnInit() method to handle any additional initialization tasks.

PipeTransform

To create a Pipe, you must implement this interface.

PlatformRef

The Angular platform is the entry point for Angular on a web page. Each page has exactly one platform, and services (such as reflection) which are common to every Angular application running on the page are bound in its scope.

Predicate

A boolean-valued function over a value, possibly including context information regarding that value's position in an array.

RendererStyleFlags2

Flags for renderer-specific style modifiers.

RendererType2

Used by RendererFactory2 to associate custom rendering data and styles with a rendering implementation.

ResolvedReflectiveProvider

An internal resolved representation of a Provider used by the Injector.

SchemaMetadata

A schema definition associated with an NgModule.

SecurityContext

A SecurityContext marks a location that has dangerous security implications, e.g. a DOM property like innerHTML that could cause Cross Site Scripting (XSS) security bugs when improperly handled.

SimpleChanges

Defines an object that associates properties with instances of SimpleChange.

TrackByFunction

An optional function passed into NgForOf that defines how to track items in an iterable (e.g. fby index or id)

Type

Represents a type that a Component or other object is instances of.

TypeDecorator

An interface implemented by all Angular type decorators, which allows them to be used as ES7 decorators as well as Angular DSL syntax.

TypeProvider

Configures the Injector to return an instance of Type when `Type' is used as the token.

ValueProvider

Configures the Injector to return a value for a token.

ViewEncapsulation

Defines template and style encapsulation options available for Component's Component.

WtfScopeFn

A scope function for the Web Tracing Framework (WTF).

Types

ANALYZE_FOR_ENTRY_COMPONENTS

A DI token that you can use to create a virtual provider that will populate the entryComponents field of components and NgModules based on its useValue property value. All components that are referenced in the useValue value (either directly or in a nested array or map) are added to the entryComponents property.

APP_BOOTSTRAP_LISTENER

All callbacks provided via this token will be called for every component that is bootstrapped. Signature of the callback:

APP_ID

A DI Token representing a unique string id assigned to the application by Angular and used primarily for prefixing application attributes and CSS styles when ViewEncapsulation.Emulated is being used.

APP_INITIALIZER

A function that will be executed when an application is initialized.

COMPILER_OPTIONS

Token to provide CompilerOptions in the platform injector.

CUSTOM_ELEMENTS_SCHEMA

Defines a schema that allows an NgModule to contain the following:

  • Non-Angular elements named with dash case (-).
  • Element properties named with dash case (-). Dash case is the naming convention for custom elements.
CompilerOptions

Options for creating a compiler

INJECTOR

An InjectionToken that gets the current Injector for createInjector()-style injectors.

InjectableProvider

Injectable providers used in @Injectable decorator.

LOCALE_ID

Provide this token to set the locale of your application. It is used for i18n extraction, by i18n pipes (DatePipe, I18nPluralPipe, CurrencyPipe, DecimalPipe and PercentPipe) and by ICU expressions.

NO_ERRORS_SCHEMA

Defines a schema that allows any property on any element.

NgIterable

A type describing supported iterable types.

PACKAGE_ROOT_URL

A token which indicates the root directory of the application

PLATFORM_ID

A token that indicates an opaque platform id.

PLATFORM_INITIALIZER

A function that will be executed when a platform is initialized.

Provider

Describes how the Injector should be configured.

StaticProvider

Describes how the Injector should be configured in a static way (Without reflection).

TRANSLATIONS

Use this token at bootstrap to provide the content of your translation file (xtb, xlf or xlf2) when you want to translate your application in another language.

TRANSLATIONS_FORMAT

Provide this token at bootstrap to set the format of your TRANSLATIONS: xtb, xlf or xlf2.

getDebugNode
getModuleFactory

Returns the NgModuleFactory with the given id, if it exists and has been loaded. Factories for modules that do not specify an id cannot be retrieved. Throws if the module cannot be found.

platformCore

This platform has to be included in any other platform

wtfCreateScope

Create trace scope.

wtfEndTimeRange

Ends a async time range operation. [range] is the return value from [wtfStartTimeRange] Async ranges only work if WTF has been enabled.

wtfLeave

Used to mark end of Scope.

wtfStartTimeRange

Used to mark Async start. Async are similar to scope but they don't have to be strictly nested. The return value is used in the call to [endAsync]. Async ranges only work if WTF has been enabled.

© 2010–2019 Google, Inc.
Licensed under the Creative Commons Attribution License 4.0.
https://v7.angular.io/api/core