代码之家  ›  专栏  ›  技术社区  ›  Pieterjan

angular 18-@let模板语法

  •  1
  • Pieterjan  · 技术社区  · 2 年前

    Angular团队刚刚实现了 @let 模板中的语法。根据 this comment 它在中实现 this commit ,应已在版本18.0.2中发布

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

    我更新了NX工作区以使用 @angular/compiler 18.0.2 ( npm update )

    enter image description here

    然而,它仍然不起作用。我仍然收到以下错误:

    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',
             ╵                ~~~~~~~~~~~~~~~~~~~~~~~~~~~
    

    那么我做错了什么?

    1 回复  |  直到 2 年前
        1
  •  2
  •   Matthieu Riegler    2 年前

    这个功能没有在18.0中登陆,也不会在任何18.0.x中登陆,因为它只在次要/主要版本中登陆。

    此外,你所指的PR只是部分实施,后续PR也在其中。前- this one )

    它更有可能降落在粉碎性较小的区域(18.1)。

    推荐文章