[英]ngFor - Can't bind to 'testid' since it isn't a known property of 'input'. how to concat id with string?
I am trying to add the index
value with my ids.我正在尝试用我的 id 添加
index
值。 but getting an error as:但得到一个错误:
Can't bind to 'testid' since it isn't a known property of 'input'.
here is my template:这是我的模板:
<td *ngFor="let col of columns; let i = index" [ngClass]="col.class" data-testid="form-create-td-{{i}}">
what is wrong with my code?我的代码有什么问题? any one help me?
有人帮我吗?
I think you will need property binding.我认为您将需要属性绑定。 So please try to replace below testid data property.
所以请尝试替换下面的 testid 数据属性。
<td ... [attr.data-testid]="'form-create-td-' + i">
For concatenation id property with string, you are doing right thing.对于带有字符串的连接 id 属性,您正在做正确的事情。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.