$event in AngularDart 1.0 is not available anymore

2019-08-09 08:54发布

问题:

Pre AngularDart 1.0 I used something like
<button on-click="handleClearClicked($event)">Clear</button>

$event is not available anymore. I get

...has no instance getter '$event'. NoSuchMethodError: method not found: '$event'

What is the alternative?

回答1:

Ha - found the answer.

Pre Angular 1.0 it worked with on-click now it has to be ng-click

So I changed the sample from above to:

<button ng-click="handleClearClicked($event)">Clear</button>

and voila - $event ist back again.
(not sure if this is a bug or a feature - but anyway, it works)