尝试在 Angular 中将 ng-template 与 Kendo Grid 一起使用时遇到问题。我拥有的 html 是有效的,并且在启动时可以正常编译和运行,但是 Visual Studio Code 显示此错误:
模板上下文未定义名为 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>
Run Code Online (Sandbox Code Playgroud)
所以 Visual Studio Code 给了我ng-template. 但是,编译时占位符确实显示了“列”的正确值。如果我保留它**let-column**而不是**let-column="column"**错误消失,但我需要的值也是如此(列现在未定义,我需要该值)。
有人能帮忙吗?
升级到 Angular 13 后,我的 Jest 单元测试失败,我不明白为什么以及如何修复它们。我\xc2\xb4已经搜索了一段时间,我找到了一些类似案例的信息。此类失败的原因似乎是 Angular 13 中的更改,这使得 Jest 有点不兼容,即使 I\xc2\xb4m 使用最新版本的 Jest (27.5)。
\n这是我的 package.json:
\n {\n "name": "app-angular",\n "version": "6.67.1",\n "scripts": {\n "ng": "ng",\n "start": "ng serve",\n "build": "ng build",\n "serve-high-memory": "node --max_old_space_size=8000 ./node_modules/@angular/cli/bin/ng serve",\n "serve-open-high-memory": "node --max_old_space_size=8000 ./node_modules/@angular/cli/bin/ng serve --open",\n "dev-high-memory": "node --max_old_space_size=8000 ./node_modules/@angular/cli/bin/ng build -c dev",\n "dev-test-high-memory": "node --max_old_space_size=8000 ./node_modules/@angular/cli/bin/ng build -c dev-test",\n "staging-high-memory": "node --max_old_space_size=8000 ./node_modules/@angular/cli/bin/ng build -c staging",\n "release-high-memory": "node --max_old_space_size=8000 ./node_modules/@angular/cli/bin/ng build -c release",\n "prod-high-memory": "node --max_old_space_size=8000 ./node_modules/@angular/cli/bin/ng build -c production",\n …Run Code Online (Sandbox Code Playgroud)