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<Null>();
  @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');
  }
}

Constructors

Output([String bindingPropertyName ])
const

Properties

bindingPropertyName → String
final
hashCode → int
The hash code for this object. [...]
read-only, inherited
runtimeType → Type
A representation of the runtime type of the object.
read-only, 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

Operators

operator ==(other) → bool
The equality operator. [...]
inherited