# Code coverage report for ./src/ocLazyLoad.loaders.cssLoader.js

## Statements: 100% (12 / 12) Branches: 100% (0 / 0) Functions: 100% (7 / 7) Lines: 100% (12 / 12) Ignored: none

All files » ./src/ » ocLazyLoad.loaders.cssLoader.js

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33

    1

    1
    29

    28
    3
    3
    3

    3
    2

    1

    28

    28

     'use strict';

    (function (angular) {
        'use strict';

        angular.module('oc.lazyLoad').config(function ($provide) {
            $provide.decorator('$ocLazyLoad', function ($delegate, $q) {
                /**
                 * cssLoader function
                 * @type Function
                 * @param paths array list of css files to load
                 * @param callback to call when everything is loaded. We use a callback and not a promise
                 * @param params object config parameters
                 * because the user can overwrite cssLoader and it will probably not use promises :(
                 */
                $delegate.cssLoader = function (paths, callback, params) {
                    var promises = [];
                    angular.forEach(paths, function (path) {
                        promises.push($delegate.buildElement('css', path, params));
                    });
                    $q.all(promises).then(function () {
                        callback();
                    }, function (err) {
                        callback(err);
                    });
                };
                $delegate.cssLoader.ocLazyLoadLoader = true;

                return $delegate;
            });
        });
    })(angular);
    //# sourceMappingURL=data:application/json;base64,