| CARVIEW |
Select Language
HTTP/2 301
location: https://raw.githubusercontent.com/urish/angular-load/master/angular-load.js
accept-ranges: bytes
age: 0
date: Tue, 30 Dec 2025 11:28:18 GMT
via: 1.1 varnish
x-served-by: cache-bom-vanm7210082-BOM
x-cache: MISS
x-cache-hits: 0
x-timer: S1767094098.711570,VS0,VE923
vary: Accept-Encoding
x-fastly-request-id: a3837a2cc41aa673135dcfdb346ab66d66d7396d
content-length: 0
HTTP/2 200
cache-control: max-age=300
content-security-policy: default-src 'none'; style-src 'unsafe-inline'; sandbox
content-type: text/plain; charset=utf-8
etag: W/"8857f633835625ba4b735604695d66e7da8cabe004c7a0d5ec1b0bb96f7cb826"
strict-transport-security: max-age=31536000
x-content-type-options: nosniff
x-frame-options: deny
x-xss-protection: 1; mode=block
x-github-request-id: 8A95:3656DD:EBD24A:1E7D9E0:6953B752
content-encoding: gzip
accept-ranges: bytes
date: Tue, 30 Dec 2025 11:28:18 GMT
via: 1.1 varnish
x-served-by: cache-bom-vanm7210062-BOM
x-cache: MISS
x-cache-hits: 0
x-timer: S1767094099.692160,VS0,VE237
vary: Authorization,Accept-Encoding
access-control-allow-origin: *
cross-origin-resource-policy: cross-origin
x-fastly-request-id: 4bc4ac8eb9f5e99434b9d26355763c76a55ee44b
expires: Tue, 30 Dec 2025 11:33:18 GMT
source-age: 0
content-length: 817
/* angular-load.js / v0.4.2 / (c) 2014, 2015, 2016 Uri Shaked / MIT Licence */
angular.module('angularLoad', [])
.service('angularLoad', ['$document', '$q', '$timeout', function ($document, $q, $timeout) {
var document = $document[0];
var promises = {};
function loader(createElement) {
return function(url) {
if (typeof promises[url] === 'undefined') {
var deferred = $q.defer();
var element = createElement(url);
element.onload = element.onreadystatechange = function (e) {
if (element.readyState && element.readyState !== 'complete' && element.readyState !== 'loaded') {
return;
}
$timeout(function () {
deferred.resolve(e);
});
};
element.onerror = function (e) {
$timeout(function () {
deferred.reject(e);
});
};
promises[url] = deferred.promise;
}
return promises[url];
};
}
/**
* Dynamically loads the given script
* @param src The url of the script to load dynamically
* @returns {*} Promise that will be resolved once the script has been loaded.
*/
this.loadScript = loader(function (src) {
var script = document.createElement('script');
script.src = src;
document.body.appendChild(script);
return script;
});
/**
* Dynamically loads the given CSS file
* @param href The url of the CSS to load dynamically
* @returns {*} Promise that will be resolved once the CSS file has been loaded.
*/
this.loadCSS = loader(function (href) {
var style = document.createElement('link');
style.rel = 'stylesheet';
style.type = 'text/css';
style.href = href;
document.head.appendChild(style);
return style;
});
/**
* Dynamically unloads the given CSS file
* @param href The url of the CSS to unload dynamically
* @returns boolean that will be true once the CSS file has been unloaded successfully or otherwise false.
*/
this.unloadCSS = function (href) {
delete promises[href];
var docHead = document.head;
if(docHead) {
var targetCss = docHead.querySelector('[href="' + href + '"]');
if(targetCss) {
targetCss.remove();
return true;
}
}
return false;
};
}]);