Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/84.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angular/27.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
谁能说出如何使用angular2中的打印机打印html模板?_Html_Angular_Types - Fatal编程技术网

谁能说出如何使用angular2中的打印机打印html模板?

谁能说出如何使用angular2中的打印机打印html模板?,html,angular,types,Html,Angular,Types,在我的Angular2组件中有一个html模板。我想做的是,当我点击同一html页面中的打印按钮时,它应该执行打印功能(如显示打印预览、继续和打印等)。 那么,你能告诉我如何用Angular2打印html模板吗?试试这个: <button click="window.print();">Print this page</button> 打印此页 没有特定于Angular2的打印方法,您只需使用JavaScript:window.print()。谢谢:)。但是,windo

在我的Angular2组件中有一个html模板。我想做的是,当我点击同一html页面中的打印按钮时,它应该执行打印功能(如显示打印预览、继续和打印等)。 那么,你能告诉我如何用Angular2打印html模板吗?

试试这个:

<button click="window.print();">Print this page</button>
打印此页

没有特定于Angular2的打印方法,您只需使用JavaScript:
window.print()
。谢谢:)。但是,window.print()不起作用。它只是打印我的HTML模板的一部分。我想打印整个模板。:(检查此项