在调用$ angularjs window.print()导致打印preVIEW显示空白页 [英] Calling $window.print() in angularjs causes the print preview to show a blank page

查看:376
本文介绍了在调用$ angularjs window.print()导致打印preVIEW显示空白页的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个很奇怪的问题在哪里,当我拨打angularjs $ window.print,我看到的是在左上角的日期,在首页的名称,在右下角的页码,并在网址左下方。然而,该页面,这是非常奇怪上没有其他内容,因为正规页面有大量的内容。

I have a very strange problem where, when I call $window.print in angularjs, all I see is the date on the top left, page name on the top, page number on the bottom right, and the url on the bottom left. However, there is no other content on the page, which is very weird since the regular page has plenty of content.

我想我的是,这与一个NG-观点我在页面上做的,但我也不太清楚。我想补充一个打印样式表,但我的问题是更上侧没有内容,风格开始。任何想法?

I guess of mine is that this has to do with an ng-view I have on the page, but I'm not too sure. I would add a print style sheet, but my problem is more on the side that there is no content to style to begin with. Any ideas?

推荐答案

尝试使用(不要忘记注入服务$超时):

Try to use(don't forget to inject service $timeout):

$timeout(function() {
    $window.print();
})

我觉得在这角度你的问题还没有完成消化周期,并更新DOM。

I think your problem in that angular haven't finishes the digest cycle and updates the DOM.

这篇关于在调用$ angularjs window.print()导致打印preVIEW显示空白页的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆