ng-template Error: The template context does not define a member called ... (Kendo Grid)

ng-template Error: The template context does not define a member called ... (Kendo Grid)

我在 Angular 中尝试将 ng-template 与 Kendo Grid 一起使用时遇到问题。 我拥有的 html 是有效的,并且在启动时可以正常编译和运行,但是 Visual Studio 代码显示此错误:

The template context does not define a member called column

这是我的代码:

<kendo-grid-column field="countryID"
  title="{{ 'location.country' | translate }}"
  width="10">
  <ng-template kendoGridEditTemplate
    let-dataItem="dataItem"
    let-column="column"
    let-formGroup="formGroup">
    <app-dropdown-single
      [placeholder]="column.title"
      [formControl]="formGroup?.controls['countryID']"
      [data]="dataDdwCountry"
      valueField="id">
    </app-dropdown-single>
  </ng-template>
</kendo-grid-column>

所以 Visual Studio 代码给出了 ng-template 的 3 个参数的错误。但是,在编译时,占位符确实显示 "column" 的正确值。 如果我只保留它 **let-column** 而不是 **let-column="column"** 错误就会消失,但我需要的值也会消失(列现在未定义,我需要该值)。

有人可以帮忙吗?

更新: 此 ng-template 错误似乎已由 Angular 语言服务版本 v0.900.11+ 解决,请在回滚到任何以前的版本之前尝试该版本或更高版本,如下所示。

原文: 这与 VS Code 中的 Angular 语言服务扩展 运行 有关。具体来说,当前高于 v0.900.4 的任何服务版本。通过查看 VS Code 中已安装的扩展选项卡,检查您当前安装的 Angular 语言服务版本。

在 Angular 语言服务团队或 Kendo UI 团队解决此问题之前(不确定是谁的错),您可以暂时禁用扩展程序的自动更新在 VS Code 中安装 Angular 语言服务的 v0.900.4 版本,方法是从此处的 GitHub 发布页面安装 .vsix 文件: https://github.com/angular/vscode-ng-language-service/releases/tag/v0.900.4

安装 .vsix 文件的说明位于 Angular 语言服务的扩展信息页面上,当您单击扩展选项卡中的扩展时,它会出现在 VS Code 中。我把它们包括在这里:

Installing a particular release build

Download the .vsix file for the release that you want to install from the releases tab.

Do not open the .vsix file directly. Instead, in Visual Studio code, go to the extensions tab. Click on the "..." menu in the upper right corner of the extensions tab, select "Install from vsix..." and then select the .vsix file for the release you just downloaded.

The extension can also be installed with the following command:

code --install-extension /path/to/ngls.vsix