GithubHelp home page GithubHelp logo

nabil-boag / angular-http-loader Goto Github PK

View Code? Open in Web Editor NEW
84.0 84.0 51.0 1.28 MB

Angular component which monitors HTTP requests and shows a custom loader element when calls start and hides it when they complete

Home Page: http://tech.wonga.com

License: MIT License

JavaScript 91.69% HTML 8.31%

angular-http-loader's People

Contributors

afternoon avatar benaud12 avatar chrisiconolly avatar cristobal avatar douglaseggleton avatar morrislaptop avatar msusur avatar nabil-boag avatar petewatts avatar zazoomauro avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

angular-http-loader's Issues

Unable to integrate module (yeoman scaffolding)

I am trying to integrate your module into my app

However, when I try to integrate it, I get a white screen.

My code is as follows:

/* global app:true */
/* exported app */
'use strict';

/**
 * @ngdoc overview
 * @name WebAppApp
 * @description
 * # WebAppApp
 *
 * Main module of the application.
 */
var app = angular
    .module('WebAppApp', [
        'ngAnimate',
        'ngAria',
        'ngCookies',
        'ngMessages',
        'ngResource',
        'ngRoute',
        'ngSanitize',
        'ngTouch',
        'angularUtils.directives.dirPagination',
        'ui.bootstrap',
        'ng.httpLoader'
    ])
    .config(function($routeProvider, $locationProvider) {
        $routeProvider
            .when('/', {
                templateUrl: 'views/login.html',
                controller: 'loginCtrl',
                //  controllerAs: 'login'
            })
            .when('/home', {
                controller: 'homeCtrl',
                templateUrl: 'views/home.html',
                resolve: {
                    "checkLoggedIn": function($location, $cookies, $rootScope) {
                        if (!$cookies.get('globals')) {
                            $location.path('/');
                        }
                    }
                },
                //controllerAs: 'home'
            })
            .when('/menteeMentors', {
                controller: 'menteeMentorsCtrl',
                templateUrl: 'views/listMentorsMentees.html',
                resolve: {
                    "checkLoggedIn": function($location, $cookies, $rootScope) {
                        if (!$cookies.get('globals')) {
                            $location.path('/');
                        }
                    }
                },
                //controllerAs: 'home'
            })
            .when('/myGoals', {
                controller: 'myGoalsCtrl',
                templateUrl: 'views/myGoals.html',
                resolve: {
                    "checkLoggedIn": function($location, $cookies, $rootScope) {
                        if (!$cookies.get('globals')) {
                            $location.path('/');
                        }
                    }
                },
                //controllerAs: 'home'
            })
            .when('/addGoal', {
                controller: 'myGoalsCtrl',
                templateUrl: 'views/addGoal.html',
                resolve: {
                    "checkLoggedIn": function($location, $cookies, $rootScope) {
                        if (!$cookies.get('globals')) {
                            $location.path('/');
                        }
                    }
                },
                //controllerAs: 'home'
            })
            .when('/signup', {
                templateUrl: 'views/signup.html',
                controller: 'signupCtrl',
                //controllerAs: 'home'
            })
            .otherwise({
                redirectTo: '/'
            });

        //check browser support
        if (window.history && window.history.pushState) {
            //$locationProvider.html5Mode(true); will cause an error $location in HTML5 mode requires a  tag to be present! Unless you set baseUrl tag after head tag like so: <head> <base href="/">

            // to know more about setting base URL visit: https://docs.angularjs.org/error/$location/nobase

            // if you don't wish to set base URL then use this
            $locationProvider.html5Mode({
                enabled: true,
                requireBase: false
            });
        }

    });

.config([
    'httpMethodInterceptorProvider',
    function(httpMethodInterceptorProvider) {
        httpMethodInterceptorProvider.whitelistDomain('validate.jsontest.com');
        httpMethodInterceptorProvider.whitelistDomain('github.com');
    }
]);

I am using yeoman scaffolding for AngularJS

How to add loader for a specific http request?

If I set the http-loader in global, such as at app.js:

httpMethodInterceptorProvider.whitelistDomain('http://*****/')

and add directive in template. If multiple request in controller for the template scope which added the loader directive. Any one request will trigger the loader show, if I want show the loader for specific http request, others dont's show, what should I do?

How to stop showing loader when working with auto complete text box?

This is a very awesome library which is I am using for my current project. Now the problem I am facing is on the page where I am having autocomplete textbox which suggests the data based on the search string, it makes HTTP request in turn to serve the purpose. So now whenever the request is made the loader appears for fraction of seconds and disappears which in turn gives a bad experience.

So, is there any way this problem can be solved? Like it can be disabled for the few request ??

Thanks in advance.

Add whitelisting to local requests regardless of domain name

Hi everyone,

I find this module very useful, however I wonder if there is a way to whitelist all domains at once? Or more precisely, my application sends $http requests to a relative path so it works both in the testing and the productive environment. Whitelisting the server's domain doesn't seem to work when making relative requests ...

Additionally, I wonder if it's possible to exclude a certain $http request to a whitelisted domain to avoid the loader to show up? I'm reloading messages every 2 seconds and don't want the loader to show up here.

Cheers,
Rob

showLoader Not getting True

We implementing your directive but when the http request is made the showLoader is not getting true. It remain false.

Operate only on specific server requests

Hi
Is there a way to show loading only on specific server $htpp requests. I need it as some requests are critical and some can be done in parallel with user web page filling.
Thanks

Version number change missed in the commit a79a096235e87cc22b8353555148b53cd4c2cf44

Refering to the commit a79a096

Because the version number wasn't updated in the commit, "bower install" apparently doesn't notice a change and doesn't download a new version of the module.

Moreover I think the main file ought to be "./angular-http-loader/app/package/js/angular-http-loader.min.js" like for example in https://github.com/angular-ui/ui-router/blob/master/bower.json or https://github.com/mgonto/restangular/blob/master/bower.json

Because of this our Gruntfile's bower_concat module must have different mainFile depenging on whether the angular-http-loader is in version 0.1.11 (old) or 0.1.11 (current). And that causes problems because the Gruntfile shouldn't differ between different installations.

Pass variable to template

Hey, thank you for that.

For some requests, I wanna show my loader, sometimes, it must be hidden.

So I have a boolean global variable in $rootScope that I have to pass trough the title attribute. Which is pretty dirty.

Btw, when my loader is shown, I can see the title as a tooltip (HTML standard) with "true" as a string...

Example:

<!-- Loader template -->
<script type="text/ng-template" id="spinner.tpl.html">
    <div ng-if="title === 'true'">
        <div class="spinner-overlay">
            <div class="spinner-container">
                <div class="loader6"></div>
            </div>
        </div>
    </div>
</script>

<!-- Show loader -->
<div ng-http-loader ttl="0" template="spinner.tpl.html" title="{{ page.loader }}"></div>

{{ page.loader }} is a boolean. Beside, this boolean is casted into a string (see my ng-if).

I suggest to add another attribute to do something like this.

<!-- Loader template -->
<script type="text/ng-template" id="spinner.tpl.html">
    <div ng-if="data === true">
        <div class="spinner-overlay">
            <div class="spinner-container">
                <div class="loader6"></div>
            </div>
        </div>
    </div>
</script>

<!-- Show loader -->
<div ng-http-loader ttl="0" template="spinner.tpl.html" data="page.loader"></div>

I hope this is enough clear.

Bests

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.