javascript - Angular 手动引导在 IE 10 上不起作用

标签 javascript angularjs gruntjs internet-explorer-10 bootstrapping

您好,使用 AngularJS 开发了 SPA。 在我的应用程序中,我使用手动引导:

<script type="text/javascript">
angular.element(document).ready(function () {
            var idsid;
            jQuery.ajax({
                type: 'GET',
                url: 'http://myServer/MyApp/getUser.aspx',
                async: false,
                jsonpCallback: 'getUserIdentity',
                contentType: "application/json",
                dataType: "jsonp",
                error: function (xhr, status, error) {
                    //alert("error"+status + " error value: "+error);//todo - remove alert, write to log
                },
                success: function (response) {
//                   do something with response
                    angular.bootstrap(document, ["MyApp"]);
                }
            });
        });</script>

此代码在 Chrome、Firefox 甚至 IE11 上运行良好。 当我尝试使用 IE10 运行它时,出现下一个错误: SCRIPT1010:预期标识符 08dcf8d5.scripts.js,第 4 行字符 1272 SCRIPT5022:[$injector:modulerr] 无法实例化模块 MyApp,原因是: [$injector:nomod] 模块“MyApp”不可用!您要么拼错了模块名称,要么忘记加载它。如果注册模块,请确保将依赖项指定为第二个参数。

http://errors.angularjs.org/1.2.15/$injector/nomod?p0=MyApp http://errors.angularjs.org/1.2.15/$injector/modulerr?p0=MyApp&p1=%5B%24injector%3Anomod%5D%20Module%20'MyApp'%20is%20not%20available!%20You%20either% 20拼写错误%20the%20module%20name%20或%20忘记%20to%20load%20it。%20如果%20注册%20a%20module%20请确保%20that%20you%20指定%20the%20dependency%20as%20the%20second%20参数。%0Ahttp% 3A%2F%2Ferrors.angularjs.org%2F1.2.15%2F%24injector%2Fnomod%3Fp0%MyApp angular.js,第 3745 行字符 9

我在将代码发布到生产环境(IIS 服务器)之前使用 grunt 来准备代码,奇怪的是,当我尝试使用本地服务器(“gruntserve”)运行我的应用程序时,IE 10 打开它没有任何问题。

我假设“grunt build”操作中的某些内容阻止 IE10 使用该应用程序。 只是提醒一下 - 在 Chrome、Firefox 和 IE11 中,我的应用程序运行良好(在本地和服务器版本上)。

有什么想法吗? 谢谢

最佳答案

关于javascript - Angular 手动引导在 IE 10 上不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24526181/

相关文章:

javascript - .load 和 .ready 之间的关系

javascript - 尝试使用转义和非转义定界符拆分字符串

javascript - 尝试从 url 读取标题时发生 Angularjs 错误

javascript - Grunt 模板变量和 if else

javascript - 从youtube播放列表ID中检索视频ID的数组

javascript - 将两个 javascript 对象合并为一个?

jquery - 如何获取 Cordova 的 IMEI 号码?

angularjs - ngRepeat 与 ngInit - ngRepeat 不会刷新渲染值

javascript - Grunt 服务命令抛出错误

gruntjs - 我可以告诉 UglifyJS 只压缩和破坏所有文件,除了一些我只想连接的文件吗?