如何解决使用angularJS加载程序$ script函数在加载angular.js 1.7.9版时出错
我正在提交以下代码,其中在升级到版本1.7.9后加载angular.js时出错 注意:相同的代码适用于angular.js 1.2.28版
请找到错误详细信息的附件图像。
代码:
function loadScripts() {
addAngularLoader();
addAsyncLoader();
/* getting below error while loading the library */
$script([
location.protocol + '//' + window.cvtDomain + '/valid_path/angular.js'],function () )
};
function addAngularLoader() {
// include angular loader,which allows the files to load in any order
/*
AngularJS Loader v1.0.7
(c) 2010-2012 Google,Inc. http://angularjs.org
License: MIT
*/
(function (i) {
'use strict'; function d(c,b,e) { return c[b] || (c[b] = e()) } return d(d(i,"angular",Object),"module",function () {
var c = {}; return function (b,e,f) {
e && c.hasOwnProperty(b) && (c[b] = null); return d(c,function () {
function a(a,d) { return function () { c[d || "push"]([a,arguments]); return g } } if (!e) throw Error("No module: " + b); var c = [],d = [],h = a("$injector","invoke"),g = {
_invokeQueue: c,_runBlocks: d,requires: e,name: b,provider: a("$provide","provider"),factory: a("$provide","factory"),service: a("$provide","service"),value: a("$provide","value"),constant: a("$provide","constant","unshift"),filter: a("$filterProvider","register"),controller: a("$controllerProvider",directive: a("$compileProvider","directive"),config: h,run: function (a) { d.push(a); return this }
}; f && h(f); return g
})
}
})
})(window);
}
function addAsyncLoader() {
// include a third-party async loader library
/*!
* $script.js v1.3
* https://github.com/ded/script.js
* Copyright: @ded & @fat - Dustin Diaz,Jacob Thornton 2011
* Follow our software http://twitter.com/dedfat
* License: MIT
*/
!function (a,c) { function t(a,c) { var e = b.createElement("script"),f = j; e.onload = e.onerror = e[o] = function () { e[m] && !/^c|loade/.test(e[m]) || f || (e.onload = e[o] = null,f = 1,c()) },e.async = 1,e.src = a,d.insertBefore(e,d.firstChild) } function q(a,b) { p(a,function (a) { return !b(a) }) } var d = b.getElementsByTagName("head")[0],e = {},f = {},g = {},h = {},i = "string",j = !1,k = "push",l = "DOMContentLoaded",m = "readyState",n = "addEventListener",o = "onreadystatechange",p = function (a,b) { for (var c = 0,d = a.length; c < d; ++c) if (!b(a[c])) return j; return 1 }; !b[m] && b[n] && (b[n](l,function r() { b.removeEventListener(l,r,j),b[m] = "complete" },b[m] = "loading"); var s = function (a,d) { function o() { if (!--m) { e[l] = 1,j && j(); for (var a in g) p(a.split("|"),n) && !q(g[a],n) && (g[a] = []) } } function n(a) { return a.call ? a() : e[a] } a = a[k] ? a : [a]; var i = b && b.call,j = i ? b : d,l = i ? a.join("") : b,m = a.length; c(function () { q(a,function (a) { h[a] ? (l && (f[l] = 1),o()) : (h[a] = 1,l && (f[l] = 1),t(s.path ? s.path + a + ".js" : a,o)) }) },0); return s }; s.get = t,s.ready = function (a,c) { a = a[k] ? a : [a]; var d = []; !q(a,function (a) { e[a] || dk }) && p(a,function (a) { return e[a] }) ? b() : !function (a) { g[a] = g[a] || [],g[a]k,c && c(d) }(a.join("|")); return s }; var u = a.$script; s.noConflict = function () { a.$script = u; return this },typeof module != "undefined" && module.exports ? module.exports = s : a.$script = s }(this,document,setTimeout);
}
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。