I'm working on an AngularJS
application and I want to print the view. So I'm I've used the window.print()
function, and it does give me the opportunity to print, however nothing shows in the print. How can this be?
My view.controller
angular.module('app')
.controller('viewController', ['$scope', '$state', '$interval', '$window', 'view', 'socketService', function ($scope, $state, $interval, $window, view, socketService) {
...
$scope.print = function () {
console.log('content is printed');
window.print();
};
...
}]);
the view.html
...
<table class="table table-striped table-hover">
<thead>
<tr>
<td ng-repeat="value in values">
<h3>
{{ value.shownName | capitalize }}
</h3>
</td>
</tr>
</thead>
<tbody>
<tr ng-repeat="item in items">
<td ng-repeat="value in values">
{{ findMatch(item, value.matchValue) }}
</td>
</tr>
</tbody>
</table>
<div class="viewNavigation">
<!-- Print -->
<a href class="btn btn-default" ng-click="print()" ng-show="viewFunctions.print"><i class="glyphicon glyphicon-print"></i> Print</a>
<div class="clearfix"></div>
</div>