'I want to display a list of products with details dynamically with jspdf-autotable in angular using only typescript

this is what i have as default for my jspdf

   autoTable(doc, {
      head: [['Product', 'Quantity', 'Discount', 'Prix']],
      body: [
        ['product1', '2', '12','1000'],
        ['Product2', '5', '0',  '7000'],
        ['Product3', '1', '8',  '900'],
        ['Product4', '8', '0',  '1000']
      ],
      theme: 'striped',
      headStyles:{
        fillColor: '#343a40'
      }
    });

and i want to change the lists in the body by a dynamic list : product[]

i tried a method with a loop but i didnt know what im really doing

autoTable(doc, {
      head: [['Produit Adcaisse', 'Quantité', 'Remise', 'Prix']],
      body:   this.bodyRows(),
      theme: 'striped',
      headStyles:{
        fillColor: '#343a40'
      }
    });


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source