Search code examples
angularletangular18angular-control-flow

angular 18 - @let syntax in templates


The Angular team just implemented the new @let syntax in templates. According to this comment it's implemented in this commit, which should already be released in version 18.0.2

enter image description here enter image description here enter image description here enter image description here

I updated my NX workspace to use @angular/compiler 18.0.2 (npm update)

enter image description here

However it's still not working. I'm still getting the following error:

X [ERROR] NG5002: Incomplete block "let showSpan". If you meant to write the @ character, you should use the "@" HTML entity instead. [plugin angular-compiler]

    libs/example-ng-bootstrap/calendar/src/calendar.component.html:32:16:
      32 │                 @let showSpan = (day !== null) && day.isInMonth;
         ╵                 ~~~~~~~~~~~~~~

  Error occurs in the template of component BsCalendarComponent.

    libs/example-ng-bootstrap/calendar/src/calendar.component.ts:14:15:
      14 │   templateUrl: './calendar.component.html',
         ╵                ~~~~~~~~~~~~~~~~~~~~~~~~~~~

So what am I doing wrong?


Solution

  • This feature did not land in 18.0 and won't in any 18.0.x as features only land in minor/major releases.

    Also the PR you're pointing at is only a partial implementation, with follow-up PRs comming. (ex this one)

    It's more likely to land in the upcomming minor (18.1).