Declare reusable UI building blocks for an application.
Each Angular component requires a single @Component
annotation. The
@Component
annotation specifies when a component is instantiated, and
which properties and hostListeners it binds to.
When a component is instantiated, Angular
- creates a shadow DOM for the component,
- loads the selected template into the shadow DOM and
-
creates all the injectable objects configured with providers and viewProviders.
All template expressions and statements are then evaluated against the component instance.
For details on the @View
annotation, see View.
Lifecycle hooks
When the component class implements some lifecycle-hooks the callbacks are called by the change detection at defined points in time during the life of the component.
- Inheritance
- Object
- Injectable
- Directive
- Component
Constructors
- Component({String selector, List<String> inputs, List<String> outputs, Map<String, String> host, String exportAs, String moduleId, List providers, List viewBindings, List viewProviders, ChangeDetectionStrategy changeDetection: ChangeDetectionStrategy.Default, Map<String, dynamic> queries, String templateUrl, String template, bool preserveWhitespace: true, List<String> styleUrls, List<String> styles, List directives, List pipes, ViewEncapsulation encapsulation })
-
const
Properties
- changeDetection → ChangeDetectionStrategy
-
Defines the used change detection strategy.
read-only - directives → List
-
read-only
- encapsulation → ViewEncapsulation
-
read-only
- exportAs → String
-
Defines the name that can be used in the template to assign this directive to a variable.
read-only, inherited - hashCode → int
-
Get a hash code for this object.
read-only, inherited - host → Map<String, String>
-
Specify the events, actions, properties and attributes related to the host element.
read-only, inherited - inputs → List<String>
-
Enumerates the set of data-bound input properties for a directive
read-only, inherited - moduleId → String
-
The module id of the module that contains the component. Needed to be able to resolve relative urls for templates and styles. In Dart, this can be determined automatically and does not need to be set. In CommonJS, this can always be set to
module.id
.read-only - outputs → List<String>
-
Enumerates the set of event-bound output properties.
read-only, inherited - pipes → List
-
read-only
- preserveWhitespace → bool
-
read-only
- providers → List
-
Defines the set of injectable objects that are visible to a Directive and its light DOM children.
read-only, inherited - queries → Map<String, dynamic>
-
Configures the queries that will be injected into the directive.
read-only, inherited - runtimeType → Type
-
A representation of the runtime type of the object.
read-only, inherited - selector → String
-
The CSS selector that triggers the instantiation of a directive.
read-only, inherited - styles → List<String>
-
read-only
- styleUrls → List<String>
-
read-only
- template → String
-
read-only
- templateUrl → String
-
read-only
- viewBindings → List
-
read-only
- viewProviders → List
-
Defines the set of injectable objects that are visible to its view DOM children.
read-only
Operators
-
operator ==(
other) → bool -
The equality operator.
inherited
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a non-existent method or property is accessed.
inherited -
toString(
) → String -
Returns a string representation of this object.
inherited