angularjs 数组添加怎样加loading

angular-loading-bar - AngularJS Modules, Plugins and Directives
A fully automatic loading / progress bar for your angular apps.
159 people use it
angular-loading-bar
The idea is simple: Add a loading bar / progress bar whenever an XHR request goes out in angular.
Multiple requests within the same time period get bundled together such that each response increments the progress bar by the appropriate amount.
This is mostly cool because you simply include it in your app, and it works.
There's no complicated setup, and need to maintain the stat it's all handled automatically by the interceptor.
Requirements: AngularJS 1.2+
include the loading bar as a dependency for your app.
If you want animations, include ngAnimate as well.
include the supplied CSS file (or create your own).
That's it -- you're done!
via bower:
Why I created this
There are a couple projects similar to this out there, but none were ideal for me.
All implementations I've seen require that you maintain state on behalf of the loading bar.
In other words, you're setting the value of the loading/progress bar manually from potentially many different locations.
This becomes complicated when you have a very large application with several services all making independant XHR requests. It becomes even more complicated if you want these services to be loosly coupled.
Additionally, Angular was created as a highly testable framework, so it pains me to see Angular modules without tests.
That is not the case here as this loading bar ships with 100% code coverage.
Goals for this project:
Make it automatic
Unit tests, 100% coverage
Must work well with ngAnimate
Must be styled via external CSS (not inline)
No jQuery dependencies
Configuration
The insertion of the spinner can be controlled through configuration.
It's on by default, but if you'd like to turn it off, simply configure the service:
How it works:
This library is split into two files, an $http interceptor, and a service:
Interceptor
The interceptor simply listens for all outgoing XHR requests, and then instructs the loadingBar service to start, stop, and increment accordingly.
There is no public API for the interceptor.
The service is responsible for the presentation of the loading bar.
It injects the loading bar into the DOM, adjusts the width whenever set() is called, and complete()s the whole show by removing the loading bar from the DOM.
Service API (advanced usage)
Under normal circumstances you won't need to use this.
However, if you wish to use the loading bar without the interceptor, you can do that as well.
Simply include the loading bar service as a dependency instead of the interceptor in your angular module:
Credit goes to
for his excellent .
Licensed under the MIT license
Please enable JavaScript to view the
This page was last updated over 2 years ago.The page is temporarily unavailable
nginx error!
The page you are looking for is temporarily unavailable.
Please try again later.
Website Administrator
Something has triggered an error on your
This is the default error page for
nginx that is distributed with
It is located
/usr/share/nginx/html/50x.html
You should customize this error page for your own
site or edit the error_page directive in
the nginx configuration file
/etc/nginx/nginx.conf.The page is temporarily unavailable
nginx error!
The page you are looking for is temporarily unavailable.
Please try again later.
Website Administrator
Something has triggered an error on your
This is the default error page for
nginx that is distributed with
It is located
/usr/share/nginx/html/50x.html
You should customize this error page for your own
site or edit the error_page directive in
the nginx configuration file
/etc/nginx/nginx.conf.The page is temporarily unavailable
nginx error!
The page you are looking for is temporarily unavailable.
Please try again later.
Website Administrator
Something has triggered an error on your
This is the default error page for
nginx that is distributed with
It is located
/usr/share/nginx/html/50x.html
You should customize this error page for your own
site or edit the error_page directive in
the nginx configuration file
/etc/nginx/nginx.conf.

我要回帖

更多关于 angularjs 加密 的文章

 

随机推荐