angular-http-loader icon indicating copy to clipboard operation
angular-http-loader copied to clipboard

Add the ability to disable http loader for certain urls on a white listed domain

Open chrisiconolly opened this issue 9 years ago • 4 comments

It would be good to have the ability to stop http loader from showing for certain urls on a whitelisted domain.

This request was originally part of https://github.com/wongatech/angular-http-loader/issues/21

chrisiconolly avatar Dec 12 '15 18:12 chrisiconolly

You can check my fork i have implemented blacklistDomain thing for myself you too can use.

Cheers!

https://github.com/corientdev/angular-http-loader

corientdev avatar Feb 23 '17 14:02 corientdev

@corientdev how to implement your code for blacklisting URL ?? Actually, I don't want to show the loader when I am making asyc request for autocomplete textbox. I tried implementing your blacklisting changes but it does not seem to be working for me. Thanks

msgadi avatar Mar 20 '18 12:03 msgadi

@mgadirocks can you show me your sample code? It should work fine..

vishalv26 avatar Mar 20 '18 12:03 vishalv26

@corientdev I made a little tweak to your code. In function isUrlOnWhitelist I placed the

for (var j = blackdomains.length; j--;) {
                    if (url.indexOf(blackdomains[j]) !== -1) {
                        return false;
                    }
                } 

Above

if (url.substring(0, 2) !== '//' && url.indexOf('://') === -1 && whitelistLocalRequests) {
                    return true;
                }

And it worked for me!

Why I did that because. First I want to check blacklisted URLs array which I am listing in my config function of my app.js. then it should fall to check the whitelistLocalRequests.

Indeed your code helped me @corientdev

Many Thanks.

Cheers!

msgadi avatar Mar 22 '18 06:03 msgadi