[英]AngularJS : how to wait until translation complete
我正在使用AngularJS开发可打印业务表格的应用程序。 从Google Cloud Endpoint检索数据,使用角度平移进行平移,然后打开打印对话框。
我的应用程序在几乎所有情况下都可以工作,但是有时在翻译完成之前会打开打印对话框。
MyContoller.js就是这样。
app.controller('MyController', ['$scope','$location','errorServiceFactory',
function ($scope,$location,errorServiceFactory) {
var param = $location.search();
$scope.list = [];
loadingPanelFadeIn();
gapi.client.myCloudEndpoint.retrieve({
id:param.id,
}).execute(function (resp) {
if(!resp.code){
loadingPanelFadeOut();
$scope.list = resp.items;
$scope.$apply();
window.print();
}else{
errorServiceFactory.errorService(resp);
}
loadingPanelFadeOut();
});
}]);
像这样的html。
<div class="myclass" ng-repeat="item in list">
<span class="big" style="(snip)" translate="title"> val1 </span>
<span class="big" style="(snip)" translate="to" translate-values="{to: '{{item.field1}}'}"> val2 </span>
:
在大多数情况下,转换后的值会显示在打印预览中,但有时会显示val1 val2
。
翻译完成后,如何修复程序以打开打印对话框?
只是隐藏内容,直到加载DOM
[ng\\:cloak], [ng-cloak], [data-ng-cloak], [x-ng-cloak], .ng-cloak, .x-ng-cloak { display: none !important; }
<div ng-cloak> <div class="myclass" ng-repeat="item in list"> <span class="big" style="(snip)" translate="title"> val1 </span> <span class="big" style="(snip)" translate="to" translate-values="{to: '{{item.field1}}'}"> val2 </span> </div> </div>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.