ngFor - Can't bind to 'testid' since it isn't a known property of 'input'. how to concat id with string?
Asked Answered
C

1

11

I am trying to add the index value with my ids. 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?

Chicky answered 9/11, 2019 at 4:22 Comment(4)
what is testid?Attalie
adding for test requirement for get the id. if I remove {{i}} - works fineChicky
Can you please share how you define the testid and how you calling it?Fifine
testing-library.com/docs/dom-testing-library/…, please visit here. I use the testing-libraryChicky
E
24

I think you will need property binding. So please try to replace below testid data property.

<td ... [attr.data-testid]="'form-create-td-' + i">

For concatenation id property with string, you are doing right thing.

Egide answered 9/11, 2019 at 5:1 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.