Thanks to visit codestin.com
Credit goes to github.com

Skip to content

escaped double braces are treated as interpolation #62174

Open
@jnizet

Description

@jnizet

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

compiler

Is this a regression?

No

Description

Since the introduction of the control flow syntax, the { and } characters must be replaced in templates by HTML character entities, i.e. { and }, or &#lbrace; and &#rbrace.

But when you use these character entities with the goal of showing the syntax Angular uses for interpolation, then the compiler interprets these entities as actual braces and considers it's a real interpolation.

So, for example, having {{ }} in a template makes the compiler fail with the error

NG5002: Parser Error: Blank expressions are not allowed in interpolated strings at column 0 in [{{ }}
]

Please provide a link to a minimal reproduction of the bug

https://stackblitz.com/edit/stackblitz-starters-yvltw3bh?file=src%2Fmain.ts

Please provide the exception or error you saw

NG5002: Parser Error: Blank expressions are not allowed in interpolated strings at column 0 in [{{ }}
]

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

Angular CLI: 20.0.3
Node: 22.16.0
Package Manager: npm 10.9.2
OS: darwin x64

Angular: 20.0.4
... common, compiler, compiler-cli, core, forms
... platform-browser, platform-server, router

Package                      Version
------------------------------------------------------
@angular-devkit/architect    0.2000.3
@angular-devkit/core         20.0.3
@angular-devkit/schematics   20.0.3
@angular/build               20.0.3
@angular/cli                 20.0.3
@angular/ssr                 20.0.3
@schematics/angular          20.0.3
rxjs                         7.8.2
typescript                   5.8.3
zone.js                      0.15.1

Anything else?

I would expect the compiler to treat ignore character entities regarding interpolation, just as it ignores them regarding the control flow.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions