There is a print method available:
printData(data): void {
console.log(data);
let printContents, popupWin;
popupWin = window.open();
popupWin.document.write(`
<html>
<head>
<title>Print tab</title>
<style>
table {
font-family: arial, sans-serif;
border-collapse: collapse;
width: 100%;
}
td, th {
border: 1px solid #dddddd;
text-align: left;
padding: 8px;
}
tr:nth-child(even) {
background-color: #dddddd;
}
</style>
</head>
<body onload="window.print()">
<table>
<tr>
<th>Service Code</th>
<th>Service Name</th>
<th>Due Date</th>
<th>Amount Due</th>
</tr>
for (let entry of someArray) {
<tr>
<td>{{entry.name}}}</td>
<td>{{entry.code}}</td>
<td>{{entry.something}}</td>
<td>{{entry.something2}}</td>
</tr>
}
</table>
</body>
</html>`
);
popupWin.document.close();
}
I am looking to include a loop in the template to display all data within the tr tags. Any suggestions on how to achieve this?