Issue
I'm using the latest release of Angular 17.0.0-next.6 which add support for the new control flow, I saw people in twitter talking it's working fine for them, so it must be my problem
I'm using everything as expected in a new project and replace the app.component.html with this code
@if(title) {
title
} @else {
no title
}
but it gives me the following errors
X [ERROR] NG5002: Invalid ICU message. Missing '}'. [plugin angular-compiler]
src/app/app.component.html:6:0:
6 │
╵ ^
Error occurs in the template of component AppComponent.
src/app/app.component.ts:9:15:
9 │ templateUrl: './app.component.html',
╵ ~~~~~~~~~~~~~~~~~~~~~~
X [ERROR] NG5002: Unexpected character "EOF" (Do you have an unescaped "{" in your template? Use "{{ '{' }}") to escape it.) [plugin angular-compiler]
src/app/app.component.html:6:0:
6 │
╵ ^
Error occurs in the template of component AppComponent.
src/app/app.component.ts:9:15:
9 │ templateUrl: './app.component.html',
╵ ~~~~~~~~~~~~~~~~~~~~~~
link for stackblitz
Solution
You need to enable these block types in the angularCompilersOptions in tsconfig.json
{
"angularCompilersOptions": {
....
"_enabledBlockTypes": ["if","for","switch","defer"]
}
}
Answered By - Madhu
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.