Output class
Declares an event-bound output property.
When an output property emits an event, an event handler attached to that event the template is invoked.
The Output 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
@Directive(selector: 'interval-dir')
class IntervalDir {
final _everySecond = new StreamController<String>();
@Output()
final get everySecond => _everySecond.stream;
final _every5Secs = new StreamController<void>();
@Output('everyFiveSeconds')
final get every5Secs => _every5Secs.stream;
IntervalDir() {
setInterval(() => _everySecond.add("event"), 1000);
setInterval(() => _every5Secs.add(null), 5000);
}
}
@Component(
selector: 'app',
template: '''
<interval-dir
(everySecond)="everySecond()"
(everyFiveSeconds)="everyFiveSeconds()">
</interval-dir>
''',
directives: const [IntervalDir])
class App {
void everySecond() {
print('second');
}
everyFiveSeconds() {
print('five seconds');
}
}
- Annotations
-
- @Target({TargetKind.field, TargetKind.getter})
Properties
- bindingPropertyName → String?
-
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