2

I would like to print a part of my page.
Actually, i try, to call another page with my part only and print this.

But the print result isn't the view result. My print result doesn't render angular binding.

My MainView

<div id="main-content" ng-controller="ConsulterSectionController">
    <ng-include src="'app/plugins/pilotage/views/templates/_section.html'" ng-init="initParams()" />
</div>

My call to print

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);
}

Here is my screen view http://hpics.li/ac5744d

Here is my print view http://hpics.li/95436c8

I try this : Print a div using javascript in angularJS single page application, but angular attributs aren't interpret.

Do you have any idea to print my view binding?

EDIT : 18/06

If i replace

this.$timeout(function () { popupWin.document.close();}, 2000, true);
}

by

setTimeout(function () { popupWin.document.close();}, 0);

it's work only for chrome but i need to work with ie11

Community
  • 1
  • 1
Yoann
  • 21
  • 6

1 Answers1

0

I try this : Print a div using javascript in angularJS single page aplication, but angular attributs aren't interpret.

You need to have angular + your app javascript loaded on the print page /Efficience/printEcran.html in order for it to interpret / databind stuff like {{}}

basarat
  • 261,912
  • 58
  • 460
  • 511
  • I know that but i didn't know why my app isn't load in my print view when it's load on my screen view (it's the same html) – Yoann Jun 18 '15 at 07:03