I'm trying to to figure out how to display the elements of my array inside
my object. In my case I have a list of exercises being displayed and inside
the object there is an array that are the repetitions and each element
corresponding to set number. Below you will see the data i'm working with
how i'm currently trying to access them should be noted, I am able to
display the exercises I just cant get the particular array to be associated
with the object that it's suppose to be currently when I expand the mat
element there are just 5 arrays inside with the elements belonging.
this.usersSession = [{ "exercise": "chest press", sets: [12, 45, 32, 14] },
{ "exercise": "cable crossover", sets: [12, 5, 6, 31, 1] },
{ "exercise": "incline chest press", sets: [12, 45, 32, 14] },
{ "exercise": "decline chest press", sets: [12, 88, 2, 1] },
{ "exercise": "push up ", sets: [12, 45, 32, 14] }
]
this.exercise = this.usersSession.map(function (exercise_names) {
return exercise_names.exercise
});
console.log(this.exercise)
this.set = this.usersSession.map(function (sets_reps) {
return sets_reps.sets
});
=================================================================================================================================================================
HTML BELOW
<mat-accordion>
<mat-expansion-panel *ngFor="let panel of usersSession">
<mat-expansion-panel-header>
{{panel.exercise}}
</mat-expansion-panel-header>
<ul>
<li *ngFor="let repsCount of set">{{set}}</li>
</ul>
</mat-expansion-panel>
</mat-accordion>
--
You received this message because you are subscribed to the Google Groups
"Angular and AngularJS discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.