I have data that looks something like this
plans:[
{
"planName": "PlanA",
"planCode": "PLN001"
},
{
"planName": "PlanB",
"planCode": "PLN002"
},
{
"planName": "PlanC",
"planCode": "PLN003"
}
]
I need to display in UI HTML like below
<p> User 1 is enrolled in PlanA , PlanB , PLanC </p>
question1: How to get the values from the plans array to display like above with commas in one statement.
question2: I need to give a hyperlink to each plan to the question1 statement which will take to a different component based on the plan code.
<a href="#{planCode}_details">{{PlanName}}</a>
The other components that the hyperlink has to take have an id to it
id="{{p.planCode}}_details"
Any help is appreciated
This is what I tried so far.
<p *ngIf="plans?.length > 0">{{UserName}} has a balance in the {{plans.planName.join(', ')}} .</p>