angular - 在字符串Angular中使用for循环索引
问题描述
我需要它在制作表单的同时遍历不同的对象,我认为处理提交的方式是使用它:
<form (ngSubmit)="submitForm{{u}}()">
问题是我无法弄清楚如何让索引(u)进入字符串而不引发错误。
Parser Error: Got interpolation ({{}}) where expression was expected
我知道
(ngSubmit)={{u}}
可以,但我还需要函数名。
谢谢
解决方案
正如错误所说,你不需要{{}}
,它应该是
<form (ngSubmit)="submitForm(u)">
推荐阅读
- python - 如何使用按钮将图像加载到 kivy 窗口中?
- r - R - 在 plot_ly 中结合 tidy eval 和 tilde 时出错
- python - 如何修复“参数未填充”错误?
- javascript - 反应JS中的打字稿
- angular - 当用户选择多个“x”选项时禁用未选择的选项
- flutter - 在“有效飞镖”之后捕获错误和异常的正确方法是什么?
- electron - 在windows上创建APPX包和DMG包
- javascript - 使用 CSS 调整图像大小时如何解决模糊图像问题?
- python - Pygame - 如何从下到上逐渐填充对象?
- nativescript - ios - 无法单击 radlistview 中的第一项