0

I am trying to display member's education and work experience using Angular. The code i tried is here: i am getting neither error nor displaying the data. i am sure that i am lost but i hope someone out there will help me.

Thanks for you help.

 <tr *ngFor="let member of members">
                  <td>{{ member.firstName }}</td>
                  <td>{{ member.lastName }}</td>
                  <td>{{ member.gender?.genderName }}</td>
                  <td>{{ member.description }}</td>
    </tr>
  <tr *ngFor="let edu of member.educations">
                  <td> {{edu?.schoolName}} </td>
                  <td>Studiespesialisering</td>
                  <td>{{ edu?.startDate | date }}</td>
                  <td> {{ edu?.endDate | date }}  </td>
  </tr>

export class Member {
    id:number;
    firstName: string;
    lastName: string;
    email:string;
    gender: Gender;
    interests: Interest; 
    workexperiences: Work [];
    educations: Education[]; 
}

export class Education{
  educationsId?: number;
  schoolName: string;
  studyCity: string;
  degreeId: number;
  startDate: string;
  endDate: string;
}

export class Work {
  workExperiencesId?:number;
  jobTitle: string;
  companyName: string;
  industry: Industry;
}
1
  • The second tr block should be part of the first loop otherwise member doesn’t exist..? Commented Mar 29, 2022 at 20:20

1 Answer 1

1

Not sure if this is what you want since your code is super incomplete but here you go:

https://stackblitz.com/edit/angular-ivy-ekfp7n?file=src/app/app.component.ts

Got some version of the code running so you can see it as an example.

EDIT: Updated the blitz with the header. This is something that I came up quickly and would not super performatic, because I do 1 for for each cell in the education side. Maybe using an accordion or something for the education part would be better

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

4 Comments

Thanks so much @Luiz that is the way i wanted it. but is that possible to have the Education title for all users insted of having one for each ?
yes of course, I will update it
Do you actually want the education inside the cells with multiple entries, something like this? Aligning this that is the issue i.imgur.com/S43Qz3u.png
Exactly, Luiz. I thank you so much.

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.