我想打印我页面的一部分。
实际上,我尝试只用我的部分调用另一个页面并打印它。
但打印结果不是查看结果。我的打印结果不呈现 Angular 绑定(bind)。
我的主视图
<div id="main-content" ng-controller="ConsulterSectionController">
<ng-include src="'app/plugins/pilotage/views/templates/_section.html'" ng-init="initParams()" />
</div>
我的打印电话
printSection = (divName) => {
var temp = new Array();
temp[0] = this.$scope.model;
temp[1]=this.$scope.elementsColonne1;
temp[2]=this.$scope.elementsColonne2;
temp[3] = this.$scope.estOuvert;
var json = JSON.stringify(temp);
sessionStorage.setItem("sectionPrint", json);
var popupWin = this.$window.open('/Efficience/printEcran.html', 'Imprime Ecran', 'width=1000,height=1000');
this.$timeout(function () { console.log('6'); popupWin.document.close();}, 2000, true);
}
这是我的屏幕 View http://hpics.li/ac5744d
这是我的打印 View http://hpics.li/95436c8
我试试这个:Print a div using javascript in angularJS single page application ,但不解释 Angular 属性。
你有什么想法打印我的 View 绑定(bind)吗?
编辑:18/06
如果我替换
this.$timeout(function () { popupWin.document.close();}, 2000, true);
}
由
setTimeout(function () { popupWin.document.close();}, 0);
它只适用于 chrome 但我需要使用 ie11
最佳答案
I try this : Print a div using javascript in angularJS single page aplication, but angular attributs aren't interpret.
您需要在打印页面 /Efficience/printEcran.html
上加载 angular + 您的应用程序 javascript 才能解释/像 {{}}
关于AngularJS 打印部分页面和数据绑定(bind),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30887699/