2

In our Angular project, we use interpolation as shown below, but we also need to use this interpolated value in the [state] property. But we haev not managed so far. Any idea?

If we set id values as shown below, there is no problem.

<a routerLink="/ticket/details/" [state]="{ id: '5' }" >{{row.TicketId}}</a>

But we cannot get dynamically by obtaining row.TicketId (it is obtained as label in {{row.TicketId}}) but cannot concatenate with id parameter.

<a routerLink="/ticket/details/" [state]="{ id: {{row.TicketId}} }" >{{row.TicketId}}</a>
2
  • 6
    Did you tried [state]="{ id: row.TicketId }"? Commented Apr 12, 2019 at 12:05
  • 1
    @PatrykUszyński put it as an answer Commented Apr 12, 2019 at 12:09

2 Answers 2

2

The brackets in [state]="..." tell Angular to evaluate the template expression, so you cant use interpolation there. So, as I said in comment it should be:

[state]="{ id: row.TicketId }"
Sign up to request clarification or add additional context in comments.

Comments

0
Try  [state]="{ id: row.TicketId }"

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.