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 {
  @Output()
  final everySecond = new EventEmitter<String>();
 
  @Output('everyFiveSeconds')
  final every5Secs = new EventEmitter<String>();
 
  IntervalDir() {
    setInterval(() => everySecond.emit("event"), 1000);
    setInterval(() => every5Secs.emit("event"), 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

read-only
hashCode → int

Get a hash code for this object.

read-only, inherited
runtimeType → Type

A representation of the runtime type of the object.

read-only, inherited

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