amedeiros
amedeiros

Reputation: 167

Use for loop index in string Angular

I need it iterate through different objects while making forms at the same time and the way I thought of handling the submit was to use this:

<form (ngSubmit)="submitForm{{u}}()">

The issue is that I cannot figure out how to get the index (u) to get into the string without throwing an error.

Parser Error: Got interpolation ({{}}) where expression was expected

I know that

(ngSubmit)={{u}}

Would work but I also need the function name.

Thanks

Upvotes: 1

Views: 224

Answers (1)

Sajeetharan
Sajeetharan

Reputation: 222532

You do not need {{}} as the error says , it should be

<form (ngSubmit)="submitForm(u)">

Upvotes: 2

Related Questions