Javascript window.print()不';不要用AngularJS打印任何东西
我正在开发一个Javascript window.print()不';不要用AngularJS打印任何东西,javascript,html,angularjs,window,Javascript,Html,Angularjs,Window,我正在开发一个AngularJS应用程序,我想打印视图。很抱歉,我使用了window.print()函数,它确实给了我打印的机会,但是打印中没有显示任何内容。这怎么可能 我的视图控制器 angular.module('app') .controller('viewController', ['$scope', '$state', '$interval', '$window', 'view', 'socketService', function ($scope, $state, $interval
AngularJS
应用程序,我想打印视图。很抱歉,我使用了window.print()
函数,它确实给了我打印的机会,但是打印中没有显示任何内容。这怎么可能
我的视图控制器
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();
};
...
}]);
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>
。。。
{{value.shownName}大写}
{{findMatch(item,value.matchValue)}
@GuruprasadRao:谢谢^^我看过类似的解决方案,但是它们都是在一行上打印内容,而不是按照view.html
中的指定。我所寻找的只是调用大多数浏览器中都可以找到的打印函数。@GuruprasadRao:谢谢^^我看过类似的解决方案,但是它们都是在一行上打印内容,而不是按照view.html
中的指定。我要找的只是调用print函数,它可以在大多数浏览器中找到。