Component class

Declare reusable UI building blocks for an application.

Each Kelicap component requires a single @Component annotation. The @Component annotation specifies when a component is instantiated.

When a component is instantiated, Kelicap

  • 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.

Lifecycle hooks

When the component class implements some LCH the callbacks are called by the change detection at defined points in time during the life of the component.

Annotations
  • @Target.new({TargetKind.classType})

Constructors

Component({required String selector, String? exportAs, List<Object> providers = const [], Visibility visibility = Visibility.local, bool standalone = false, List<Object> viewProviders = const [], List<Object?> exports = const [], ChangeDetectionStrategy changeDetection = ChangeDetectionStrategy.checkAlways, String? templateUrl, String? template, bool preserveWhitespace = false, List<String> styleUrls = const [], List<String> styles = const [], List<Object> directives = const [], List<Typed<Object>> directiveTypes = const [], List<Object> pipes = const [], ViewEncapsulation encapsulation = ViewEncapsulation.emulated})
const

Properties

changeDetection ChangeDetectionStrategy
Defines the used change detection strategy.
final
directives List<Object>
final
directiveTypes List<Typed<Object>>
Declares generic type arguments for any generic directives.
final
encapsulation ViewEncapsulation
final
exportAs String?
final
exports List<Object?>
A list of identifiers that may be referenced in the template.
final
hashCode int
The hash code for this object.
no setterinherited
pipes List<Object>
final
preserveWhitespace bool
Removes all whitespace except &ngsp; and &nbsp; from template if set to false.
final
providers List<Object>
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
selector String
final
standalone bool
final
styles List<String>
final
styleUrls List<String>
final
template String?
final
templateUrl String?
final
viewProviders List<Object>
Defines the set of injectable objects that are visible to its view DOM children.
final
visibility Visibility
final

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited