Skip to content
Advertisement

filter value of select to do a partial sum

Having two classes professor and student:

  • professor.ts
JavaScript
  • student.ts
JavaScript

To add up the scores of each student relative to his teacher I did:

JavaScript

This is the HTML of the page:

JavaScript

How can I do a partial sum of the selections, assuming for example that I have 5 professor with 1 student for every professor, and want to add only the results of the first 3 student. This is the stackblitz: https://stackblitz.com/edit/angular-ivy-sjs7fg?file=src/app/app.component.ts

Advertisement

Answer

Change your total method to :-

JavaScript

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

User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement