I am using a reactive form in Angular4. I want to implement print functionality for the same. However, the reactive form values are not shown while printing. How can I achieve this? Posting my code below:
html
<section id="print-section">
<form [formGroup]="myForm" novalidate>
<div class="form-child input-wrap">
<span>Date</span>
<input type="text" placeholder="Date" class="borderStyle form-control" formControlName="date">
</div>
<div class="form-child input-wrap">
<span>Address</span>
<input type="text" placeholder="Address" class="borderStyle form-control" formControlName="address">
</div>
</form>
</section>
ts
let printContents, popupWin;
printContents = document.getElementById('print-section').innerHTML;
popupWin = window.open('', '_blank', 'top=0,left=0,height=100%,width=auto');
popupWin.document.open();
popupWin.document.write(`
<html>
<head>
<title>Print tab</title>
<style>
</style>
</head>
<body onload="window.print();window.close()">${printContents}</body>
</html>`
);
popupWin.document.close();