javascript - data-ng-hide behavior in printpreview of my application -


question: ng-hide used twice: text.name.length , !text.name.length. under both conditions content control visible on print preview. why?

my view

<div>     <div class="content" id="printable">     name  <b data-ng-hide="text.name.length">__________</b><b data-ng-hide="!text.name.length">{{text.name}}</b>      </div>     <button data-ng-click="printdiv('printable')">print</button>   </div> 

this printpreview controller show me printpreview of print page

printcontroller

app.controller('printcontroller', function ($scope) {     $scope.printdiv = function (divname) {         var printcontents = document.getelementbyid(divname).innerhtml;         var originalcontents = document.body.innerhtml;         var popupwin = window.open('', '_blank', 'width=800,height=600');         popupwin.document.open()         popupwin.document.write('<html><head><link rel="stylesheet" type="text/css" href="style.css" /></head><body onload="window.print()">' + printcontents + '</html>');           popupwin.document.close();     } }) 

because popup window, have left realm of angularjs.

notice in code how construct popup window own html element , stylesheet?

    popupwin.document.write('<html><head><link rel="stylesheet" type="text/css" href="style.css" /></head><body onload="window.print()">' + printcontents + '</html>'); 

there no sign of angular in popupwin whatsoever.

furthermore, there more angular application dom elements. when copied on dom popup window, did somehow copy on $scope too? nope.

attempting extend angular app transplanting dom akin taking job body goes office head stays @ home: doesn't work.

there better way. google angularjs print preview. results this.


Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

jsf - How to ajax update an item in the footer of a PrimeFaces dataTable? -

django - CSRF verification failed. Request aborted. CSRF cookie not set -