AngularJS 打印部分页面和数据绑定(bind)

标签 angularjs data-binding printing typescript

我想打印我页面的一部分。
实际上,我尝试只用我的部分调用另一个页面并打印它。

但打印结果不是查看结果。我的打印结果不呈现 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 才能解释/像 {{}}

这样的数据绑定(bind)

关于AngularJS 打印部分页面和数据绑定(bind),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30887699/

相关文章:

javascript - AngularJS 动态注入(inject)范围或 Controller

c# - 简单的数据绑定(bind)不起作用

c# - WPF 2 ListView 简单的选定项数据绑定(bind)

python - 如果输入 = 列表 [n] : How would I set this up?

arrays - 如何打印数组数组?

javascript - AngularJS 错误 : Argument 'FirstCtrl' is not a function, 未定义

javascript - 如何使用 Cloudinary Angular 生成 url?

javascript - 为什么不建议将 $rootScope 与函数一起使用?

带有集合对象的 WPF 数据绑定(bind)

javascript - 如何将 CSS 应用于 document.write()?