Angular 2/Dart: Binding multiple events at once

454 views Asked by At

In a Angular 2 / Dart Template I have the following line of code:

<input (keyup)="addressChanged('destination')"
       (change)="addressChanged('destination')"
       type="text"
       value="" />

Is there a syntactical way to bind multiple events at once?

Like this:

<input (keyup,change)="addressChanged('destination')"
       type="text" value="" />

Otherwise with many events there is a lot of redundancy ...

1

There are 1 answers

0
rkj On BEST ANSWER

I do not think this is currently supported. You can file a feature request: https://github.com/dart-lang/angular2/issues

Usually though each event has a separate handler - why you need to do the same thing on both keyup and change?

If this is a pattern you run into with lot of inputs you could write a directive that would handle both events.