在加载文件时显示一个加载指令
Display a loading directive while loading a file
当我上传大于4MB的图像到我的程序时,我想显示加载图标。我目前正在尝试使用mdDialog
,尽管这可能不是我需要做的。这段代码是if (fileSize < 8000000 && fileSize > 4000000)
。然而,指令加载动画没有正确显示。所以我不确定如何做到这一点?
图片上传
if (fileSize > 8000000) {
uploader.clearQueue();
console.log("Error, the selected file is too large. Image must be less than 8MB.")
}
else if (fileSize < 8000000 && fileSize > 4000000) {
$mdDialog.show({
templateUrl: 'controls/load-animate/load-animate-directive.tpl.html',
controllerAs: 'loadAnimate'
});
fileItem.formData = [
{
"targetEntityId": $scope.targetEntityId,
"entityType": $scope.entityType
}
];
$mdDialog.hide();
$scope.uploader.uploadAll();
}
load-animate-directive.tpl.html
<div id="load-animate-contain" class="layout-column layout-align-center-center">
<div class="layout-column layout-align-center-center">
<img id="load-circle-top" class="its-spinning" src="/images/img.loadCircle-top.png" />
<img id="load-circle-bottom" src="/images/img.loadCircle-bottom.png" />
<p class="m2head its-blinking">Loading...</p>
</div>
</div>
在你的fileUploadCtrl()中你可以做一些类似set $scope的事情。Loading = true/false根据你在进程中的位置,然后在你的视图
<load-animate ... ng-show="loading"></load-animate>
相关文章:
- 指令加载真的很长,检查加载时间的方法
- 在Angular JS中POST后重新加载指令方法
- 如何在控制器中加载指令
- 延迟加载角度应用程序不会加载指令
- 在加载指令模板之前加载指令 ng 包含内容
- ng-repeat中的加载指令(动态模板URL)
- ng-include 忽略加载指令
- 加载指令后运行函数
- 加载指令模板后执行 Javascript
- Meteor AngularJS应用程序未加载指令
- 不要为某些路由加载指令
- 基于值加载指令
- AngularJS在使用服务时未正确加载指令
- 加载指令时调用init函数
- 如何实现AngularJS的加载指令
- 在加载文件时显示一个加载指令
- 在加载指令模板之前没有初始化指令的作用域,导致无法加载谷歌地图
- 在控制器事件上重新加载指令
- 如何管理AngularJS中加载指令模板的404错误
- 当惰性加载指令时,它'We’我们永远不要跑步