Skip to content

Commit

Permalink
Merge pull request #79 from broem/master
Browse files Browse the repository at this point in the history
Fix for printing contents of Input
  • Loading branch information
broem committed May 27, 2020
2 parents d27859e + 9051dac commit dc44c2f
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion src/lib/ngx-print.directive.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,18 @@ public returnStyleValues() {
return html.join('\r\n');
}

/**
* @returns html section to be printed along with some associated inputs
*
*/
private getHtmlContents() {
let printContents = document.getElementById(this.printSectionId);
let innards = printContents.getElementsByTagName('input');
for(var i = 0; i < innards.length; i++) {
innards[i].defaultValue = innards[i].value;
}
return printContents.innerHTML;
}

/**
*
Expand All @@ -122,7 +134,7 @@ public returnStyleValues() {
links = this.getElementTag('link');
}

printContents = document.getElementById(this.printSectionId).innerHTML;
printContents = this.getHtmlContents();
popupWin = window.open("", "_blank", "top=0,left=0,height=auto,width=auto");
popupWin.document.open();
popupWin.document.write(`
Expand Down

0 comments on commit dc44c2f

Please sign in to comment.