angular.js - angularJS怎么实现请求的数据还未加载完成时展示“正在加载”的提示?
迷茫
迷茫 2017-05-15 16:56:25
0
2
576

在点击button发出请求后,由于网络或者数据较大的原因,页面中的angularJS双向绑定数据部分不显示,页面结构很难看,怎么能实现在所有的数据加载完成之前,弹出层覆盖掉原网页并且提示“正在加载”,等所有的数据加载完成之后,再显示带有完整数据的网页。
如下面的效果:

迷茫
迷茫

业精于勤,荒于嬉;行成于思,毁于随。

reply all (2)
PHPzhong

https://github.com/cgross/angular-busy/blob/master/README.md Use this module

    世界只因有你

    Make a mask layer in advance, display the mask when making a request (usually $http or $resource), and close the mask after promise resolves.

    The logic is that simple, but because it occurs very frequently, you have to consider how to DRY it.

    At the view level, if the mask is common to all applications, don’t write it in every route. Instead, consider writing it in the upper routing entry so that sub-routes can share it.

    At the calling level, it is simple to save the mask state in $rootScope and use DI to retrieve it at any time; if it is more elaborate, just write a service to control it.

    The mask itself can be encapsulated into a directive for easy reuse, but this thing is very simple, so it’s okay not to encapsulate it.

      Latest Downloads
      More>
      Web Effects
      Website Source Code
      Website Materials
      Front End Template
      About us Disclaimer Sitemap
      php.cn:Public welfare online PHP training,Help PHP learners grow quickly!