Skip to content

Template parser incorrectly recovers from expression errors in some cases #61792

@AndrewKushnir

Description

@AndrewKushnir

Which @angular/* package(s) are the source of the bug?

compiler

Is this a regression?

No

Description

In some cases, when a template contains expressions with invalid syntax, for example:

<input (input)="newBookmarkTags.set(($event.target as HTMLInputElement).value)">

Template parser identifies a problem, but can't recover from it, producing a build error with a lot of unrelated information.

Adding the "ai" label, since the code was originally generated by an LLM and having a clear and focused error message would increase a likelihood of a successful "repair" request to an LLM (asking to fix a given build error).

Please provide a link to a minimal reproduction of the bug

https://stackblitz.com/edit/stackblitz-starters-n1vvscar

Please provide the environment you discovered this bug in (run ng version)

Angular v20, but likely reproducible in earlier versions as well.

Metadata

Metadata

Assignees

Labels

P3An issue that is relevant to core functions, but does not impede progress. Important, but not urgentaiIssue related to using AI agentsarea: compilerIssues related to `ngc`, Angular's template compilercompiler: parserstate: has PR

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions