angular library Null safety

The primary library for the AngularDart web framework.

Import this library as follows:

import 'package:ngdart/angular.dart';

For help using this library, see the AngularDart documentation:

Classes

AfterChanges
Implement this interface to get notified when any data-bound property of your directive is changed by the Angular framework.
AfterContentChecked
Implement this interface to get notified after every check of your directive's content.
AfterContentInit
Implement this interface to get notified when your directive's content has been fully initialized.
AfterViewChecked
Implement this interface to get notified after every check of your component's view.
AfterViewInit
Implement this interface to get notified when your component's view has been fully initialized.
ApplicationRef
A reference to an Angular application running on a page.
AsyncPipe
An async pipe awaits for a value from a Future or Stream. When a value is received, the async pipe marks the component to be checked for changes.
Attribute
An annotation specifying that a constant attribute value should be injected.
ChangeDetectionStrategy
Describes within the change detector which strategy will be used the next time change detection is triggered.
ChangeDetectorRef
Provides influence over how change detection should execute for a component.
ChangeDetectorState
Describes the current state of the change detector.
ClassProvider<T extends Object>
Describes at compile-time configuring to return an instance of a class.
Component
Declare reusable UI building blocks for an application.
ComponentFactory<T extends Object>
Backing implementation behind a class T annotated with @Component.
ComponentLoader
Supports imperatively loading and binding new components at runtime.
ComponentRef<C>
Represents an instance of a Component created via a ComponentFactory.
ContentChild
Declares a reference to a single child node projected into <ng-content>.
ContentChildren
Declares a reference to multiple child nodes projected into <ng-content>.
CurrencyPipe
WARNING: this pipe uses the Internationalization API. Therefore it is only reliable in Chrome and Opera browsers.
DatePipe
Formats a date value to a string based on the requested format.
DecimalPipe
WARNING: this pipe uses the Internationalization API. Therefore it is only reliable in Chrome and Opera browsers.
Directive
An annotation that marks a class as an Angular directive, allowing you to attach behavior to elements in the DOM.
DoCheck
Implement to execute ngDoCheck and implement your own change detection.
ElementRef
A wrapper around a native element inside of a View.
EmbeddedViewRef
An embedded Angular view that can be created and destroyed dynamically.
ExceptionHandler
Provides a hook for receiving unhandled errors/exceptions.
ExistingProvider<T extends Object>
Describes at compile-time configuring to redirect to another token.
FactoryProvider<T extends Object>
Describes at compile-time configuring to invoke a factory function.
GenerateInjector
Annotates a method to generate an Injector factory at compile-time.
Host
Specifies that an injector should retrieve a dependency from any injector until reaching the closest host.
HostBinding
Declares a host property on the host component or element.
HostListener
Declares listening to eventName on the host element of the directive.
Inject
A parameter metadata that specifies a dependency.
Injectable
Compile-time metadata that marks a class Type or Function for injection.
Injector
Support for imperatively loading dependency injected services at runtime.
Input
Declares a data-bound input property.
LowerCasePipe
Transforms text to lowercase.
Module
Encapsulates a reusable set of dependency injection configurations.
MultiToken<T extends Object>
A token representing multiple values of T for dependency injection.
NgClass
The NgClass directive conditionally adds and removes CSS classes on an HTML element based on an expression's evaluation result.
NgContentRef
Represents a reference to an <ng-content> element.
NgFor
The NgFor directive instantiates a template once per item from an iterable. The context for each instantiated template inherits from the outer context with the given loop variable set to the current item from the iterable.
NgIf
Causes an element and its contents to be conditionally added/removed from the DOM based on the value of the given boolean template expression.
NgStyle
The NgStyle directive changes an element's style based on the bound style expression:
NgSwitch
Adds or removes DOM sub-trees when their match expressions match the switch expression.
NgSwitchDefault
Default case statements are displayed when no match expression matches the switch expression value.
NgSwitchWhen
Insert the sub-tree when the ngSwitchWhen expression evaluates to the same value as the enclosing switch expression.
NgTemplateOutlet
Inserts an embedded view, created from a TemplateRef.
NgZone
Handles and observes the side-effects of executing callbacks in AngularDart.
OnDestroy
Implement to execute ngOnDestroy before your component is destroyed.
OnInit
Implement to execute ngOnInit after the first change-detection completed.
OpaqueToken<T extends Object>
A token to be used instead of Type when configuring dependency injection.
Optional
A parameter metadata that marks a dependency as optional.
Output
Declares an event-bound output property.
PercentPipe
WARNING: this pipe uses the Internationalization API. Therefore it is only reliable in Chrome and Opera browsers.
Pipe
Declare reusable pipe function.
Provider<T extends Object>
Describes at compile-time how an Injector should be configured.
ReflectiveInjector
An injector that resolves Provider instances with runtime information.
ReplacePipe
Creates a new String with some or all of the matches of a pattern replaced by a replacement.
Self
Specifies that an Injector should retrieve a dependency only from itself.
SkipSelf
Specifies that the dependency resolution should start from the parent injector.
SlicePipe
Creates a new List or String containing a subset (slice) of the elements.
TemplateRef
Represents an Embedded Template that can be used to instantiate Embedded Views.
Testability
Provides testing hooks also accessible via JavaScript APIs in the browser.
TestabilityRegistry
A global registry of Testability instances given an app root element.
Typed<T extends Object>
Declares a typed directive or defines type argument of type T.
UncaughtError
An uncaught error and stackTrace emitted by NgZone.onUncaughtError.
UpperCasePipe
Implements uppercase transforms to text.
ValueProvider<T extends Object>
Describes at compile-time using a constant value to represent a token.
ViewChild
Declares a reference to a single child node in a component's template.
ViewChildren
Declares a reference to multiple child nodes in a component's template.
ViewContainerRef
Represents a container where one or more views can be attached.
ViewRef
An Angular view that can be created and destroyed dynamically.

Extensions

DeprecatedChangeDetectorRef
DeprecatedDetectChanges

Constants

APP_ID → const OpaqueToken<String>
A dependency injection token representing a unique ID for the application.
OpaqueToken<String>('APP_ID')
commonPipes → const List<Type>
A collection of built-in AngularDart core pipes.
[AsyncPipe, UpperCasePipe, LowerCasePipe, SlicePipe, DecimalPipe, PercentPipe, CurrencyPipe, DatePipe, ReplacePipe]
coreDirectives → const List<Type>
A collection of Angular core directives, such as NgFor and NgIf.
[NgClass, NgFor, NgIf, NgTemplateOutlet, NgStyle, NgSwitch, NgSwitchWhen, NgSwitchDefault]
noValueProvided → const Object
A marker that represents a lack-of-value for the useValue parameter.
'__noValueProvided__'
visibleForTemplate → const _VisibleForTemplate
Used to annotate a class, field, or method that is public for template use.
_VisibleForTemplate()

Functions

bootstrapStatic<T extends Object>(Type componentType, [List<Object> providers = const [], void initReflector()?]) Future<ComponentRef<T>>
Starts a new AngularDart application with componentType as the root.
@Deprecated('Renamed "runAppLegacy". See "runApp" for the preferred API.')
debugCheckBindings([bool enabled = true]) → void
Opt-in/out to more precise and exhaustive checking of AngularDart bindings.
debugClearComponentStyles() → void
Clears all component styles from the DOM.
enableDevTools() → void
Enables developer tools if in development mode.
provide<T extends Object>(Object token, {Type? useClass, Object useValue = noValueProvided, Object? useExisting, Function? useFactory, List<Object>? deps}) Provider<T>
Short-hand for Provider(...).
registerContentRoot(Element element) → void
Registers element as an additional location to search for components.
runApp<T extends Object>(ComponentFactory<T> componentFactory, {InjectorFactory createInjector = _identityInjector}) ComponentRef<T>
Starts a new AngularDart application with componentFactory as the root.
runAppAsync<T extends Object>(ComponentFactory<T> componentFactory, {required Future<void> beforeComponentCreated(Injector), InjectorFactory createInjector = _identityInjector}) Future<ComponentRef<T>>
Asynchronous alternative to runApp, supporting beforeComponentCreated.
runAppLegacy<T extends Object>(Type componentType, {List<Object> createInjectorFromProviders = const [], void initReflector()?}) ComponentRef<T>
Starts a new AngularDart application with componentType as the root.
runAppLegacyAsync<T extends Object>(Type componentType, {required Future<void> beforeComponentCreated(Injector), List<Object> createInjectorFromProviders = const [], void initReflector()?}) Future<ComponentRef<T>>
Starts a new AngularDart application with componentType as the root.

Enums

ViewEncapsulation
Defines template and style encapsulation options available for Component's View.
Visibility
Options for configuring whether a directive class can be injected.

Typedefs

InjectorFactory = Injector Function(Injector parent)
Defines a function that creates an injector around a parent injector.
TrackByFn = Object? Function(int index, dynamic item)
A function that can be used to return a unique key for item at index.

Exceptions / Errors

InjectionError
A class of error that is thrown related to dependency injection.
NoProviderError
Thrown when there is no dependency injection provider found for a token.