angular - TS2339:“AbstractControl”类型上不存在属性“控件”
问题描述
我正忙于 Udemy 上的“Angular - 完整指南(2021 版)”,但遇到了一些问题:
我不断收到以下错误:TS2339:“AbstractControl”类型上不存在属性“控件”我正在使用最新版本的 Angular。
这是我的 HTML 代码:
<div class="row" *ngFor="let ingredient of recipeForm.get('ingredients').controls; let i = index"
[formGroupName]="i" style="margin-top: 10px;">
<div class="col-xs-8">
任何建议将不胜感激!谢谢!
解决方案
<div
class="row"
*ngFor="let ingredientCtrl of recipeForm.get('ingredients')['controls']; let i = index"
[formGroupName]="i"
style="margin-top: 10px;">
// 只需使用 ['Controls'] 而不是 .Controls
推荐阅读
- python - 创建返回过滤对象的 django api 视图
- list - Haskell 列表理解:显示偶数和双奇数元素
- reactjs - 如何将 td contentEditable={true} 中的 e.target.textContent 传递给其他组件?
- firebase - 如何从 Flutter 中的 Firebase 实时数据库中按 categoryId 获取产品?
- c# - 无法使用 Fluent FTP 登录(错误 530 - 未登录),但 GUI FTP 客户端工作正常
- java - 我想替换元素
- curl - 如何知道 Google Apps 脚本的进度状态
- excel - 重新调整二维数组在循环的第二次迭代中给出错误 nº 9“下标超出范围”: - 无法找出原因
- python - 游戏在 Python Tic-Tac-Toe 游戏中不起作用
- python - SQLAlchemy 和 mysql 在并发请求上抛出错误