0

Html:

<coral-item *ngFor="let history of requestHistory" (click)="selectedHistory(history)"
            [title]="history+[selectedRequestType]+requestHistory">
            {{ history[selectedRequestType].Formula }}</coral-item>

where selectedRequestType is variable I want to pass dynamically but how it gets shown as:

[object Object]value[object Object],[object Object][object Object]
2
  • You are trying to print an object as string. You might want to check what those object contains and print the according key. Alternativaly, you could override the toString method of your object to return some actual values. Commented Feb 6, 2020 at 12:44
  • It would be easier if you could provide a Stackblitz and tell us which output you were expecting. Commented Feb 6, 2020 at 12:51

1 Answer 1

1

You should be able to use the following expression: [title]="history[selectedRequestType].requestHistory"

Sign up to request clarification or add additional context in comments.

1 Comment

What was the error? I use similar syntax for attribute binding without error... You could also bind it to a method like this : [title]="getRequestHistory(history)"

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.