ng-template错误:模板上下文未定义名为...的成员(Kendo Grid) [英] ng-template Error: The template context does not define a member called ... (Kendo Grid)

查看:100
本文介绍了ng-template错误:模板上下文未定义名为...的成员(Kendo Grid)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Angular的Kendo Grid中尝试使用ng-template时遇到问题. 我拥有的html是有效的,并且在启动时可以正确编译和运行,但是Visual Studio Code会显示此错误:

I have an issue when trying to use ng-template with Kendo Grid in Angular. The html I have is valid and compiles and functions properly when launched, but then Visual Studio Code shows this error:

模板上下文未定义称为列的成员

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 Code为我提供了ng-template的3个参数的错误.但是,在编译时,占位符确实显示了"column"的正确值. 如果我仅将其保留为**let-column**而不是**let-column="column"**,该错误就会消失,但是我需要的值也会消失(现在列未定义,我需要该值).

So Visual Studio Code gives me the error for the 3 parameters of the ng-template. However, when compiled the placeholder does show the correct value of "column". If I leave it just **let-column** instead of **let-column="column"** the error disappears, but so does the value I need (column is now left undefined and I need the value).

任何人都可以帮忙吗?

推荐答案

更新: 此ng-template错误似乎已由Angular Language Service版本v0.900.11 +解决,请先尝试使用该版本或更高版本,然后回滚到以下所示的任何先前版本.

Update: This ng-template error appears to have been resolved by Angular Language Service version v0.900.11+ Please try that version or greater before rolling back to any previous version as indicated below.

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

Original: This is related to the Angular Language Service extension running in VS Code. Specifically, any version of the service that is currently greater than v0.900.4. Check which version of the Angular Language Service you currently have installed by looking at the installed extensions tab in VS Code.

直到由Angular Language Service团队或Kendo UI团队解决此问题(不确定谁出错)之前,您可以暂时禁用VS Code中扩展的自动更新并安装Angular Language v0.900.4版本通过从GitHub版本页面安装.vsix文件进行服务: https://github.com/angular/vscode- ng-language-service/releases/tag/v0.900.4

Until either this is fixed by the Angular Language Service team or the Kendo UI team (not sure who is at fault), you can temporarily disable auto updating of extensions in VS Code and install version v0.900.4 of the the Angular Language Service by installing the .vsix file from the GitHub Releases page here: https://github.com/angular/vscode-ng-language-service/releases/tag/v0.900.4

在扩展名选项卡中单击扩展名时,安装.vsix文件的说明位于VS Code中附带的Angular Language Service的扩展名信息页面上.我在这里包括了它们:

The instructions for installing the .vsix file are on the extension info page for the Angular Language Service that comes up in VS Code when you click on the extension in the extensions tab. I included them here:

安装特定的发行版

从您要安装的发行版中下载.vsix文件. 发布标签.

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

请勿直接打开.vsix文件.相反,在Visual Studio代码中, 转到扩展标签.点击右上方的"..."菜单 扩展标签的一角,选择从vsix安装...",然后 选择您刚刚下载的发行版的.vsix文件.

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

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

这篇关于ng-template错误:模板上下文未定义名为...的成员(Kendo Grid)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆