[英]How to show a wait message or loading image when loading data in Umbraco's Admin custom grid editor?
我为Umbraco后台(或管理员)创建了一个自定义网格插件,但在保存所选项目之前,我想通过ID获取内容并保存属性。 这个get调用需要比预期更长的时间,因为它使用了一个promise,我希望有一种方法让我通知用户有一些数据被加载。
我找到了AngularJS的这个自定义指令插件,但我不确定将它连接到Umbraco Admin UI的最佳方法。 此外,我假设有一种标准方法可以通知用户正在进行操作并且不会离开此页面或再次单击“提交”,直到完成为止。
有没有人有任何想法用于通知Umbraco管理员用户正在加载某些内容的最佳做法?
以下是我的插件控制器中的一些代码:
dialogService.treePicker({
multiPicker: false,
treeAlias: 'content',
section: 'content',
startNodeId: startNodeIdValue,
callback: function (data) {
notificationsService.info("Success", "Selected " + data.name + " (" + data.id + ").");
//TODO: need a good way to show a loading/wait message
// until the promise is finished
//this might work but want to use the umbraco admin way
//to show a loading / wait message
$scope.loading = true;
contentResource.getById(data.id).then(function (content) {
var icon = content.icon;
$scope.control.value = {
id: data.id,
name: data.name,
path: data.path,
icon: icon
};
//this might work but want to use the umbraco admin way
//to show a loading / wait message
$scope.loading = false;
$scope.setPreview();
});
}
});
我发现Umbraco使用的指令称为umb-load-indicator ,它起作用; 但是,如果有人有更好的解决方案,我仍然很好奇。
现在这是我的视图使用$scope.loading
值的样子。
<div ng-controller="MyController">
<div style="height: 25px;" ng-if="loading">
<umb-load-indicator></umb-load-indicator>
</div>
<div ng-class="usky-editor-placeholder" ng-if="!loading">
<!-- main content goes here -->
</div>
</div>
如果您有更好的解决方案,请告诉我。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.