Move Angular event handlers to methods
- Dominant language
- TypeScript
- Stars
- 14.4k
- Forks
- 671
- PR merge metrics
- No merged PRs in 30d
Description
### Currently
As with other output, the Angular output passes in-line event handling code through. For example, this input:
```
(state.list = [...state.list, state.newItemName])}
>
```
Produces this output:
```
Add list item
```
This will not work in the general case (or in the specific case above), because Angular has its own notion of the syntax that works for an in-line event handler. Angular does not accept arbitrary TypeScript or JavaScript like a JSX/TSX-based framework.
### Expected
To make Angular output work for nontrivial event handlers, it will probably be necessary to output the event handling code into a method in the component, and call that method from the generated event handler, roughly like so:
```
Add list item
handleClick() {
this.list = [...this.list, this.newItemName]
}
```
Contributor guide
Assessment
This issue has not been assessed yet.