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

时间:2014-07-02 08:18:09

标签: javascript angularjs gruntjs internet-explorer-10 bootstrapping

Hi使用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%20misspelled%20the%20module%20name%20or%20forgot%20to%20load%20it.%20If%20registering%20a%20module%20ensure%20that%20you%20specify%20the%20dependencies%20as%20the%20second%20argument.%0Ahttp%3A%2F%2Ferrors.angularjs.org%2F1.2.15%2F%24injector%2Fnomod%3Fp0%MyApp angular.js, line 3745 character 9

我正在使用grunt准备我的代码,然后将其发布到生产(IIS服务器),奇怪的是,当我尝试使用本地服务器('grunt serve')运行我的应用程序时,IE 10打开它没有任何问题。

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

有什么想法吗? 感谢