Input class
Declares a data-bound input property.
Data-bound properties are automatically updated during change detection.
The Input annotation takes an optional parameter that specifies the name used when instantiating a component in the template. When not provided, the name of the decorated property is used.
Example
The following example creates a component with two input properties.
@Component(
selector: 'bank-account',
template: '''
Bank Name: {{bankName}}
Account Id: {{id}}
''')
class BankAccount {
@Input()
String bankName;
@Input('account-id')
String id;
// this property is not bound, and won't be automatically updated
String normalizedBankName;
}
@Component(
selector: 'app',
template: '''
<bank-account bank-name="RBC" account-id="4747"></bank-account>
''',
directives: const [BankAccount])
class App {}
- Annotations
-
- @Target({TargetKind.field, TargetKind.setter})
Properties
- bindingPropertyName → String?
-
Name used when instantiating a component in the template.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
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