Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/366.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 对象引用未设置为Internet Explorer上AngularJS中对象的实例_Javascript_Angularjs_Windows_Visual Studio_Internet Explorer - Fatal编程技术网

Javascript 对象引用未设置为Internet Explorer上AngularJS中对象的实例

Javascript 对象引用未设置为Internet Explorer上AngularJS中对象的实例,javascript,angularjs,windows,visual-studio,internet-explorer,Javascript,Angularjs,Windows,Visual Studio,Internet Explorer,症状: 当通过intranet url在Visual Studio 2015中加载AngularJS时,AngularJS库此时会抛出一个错误: line 7: if(H(b)||Ta(b)) (适用于angularjs.min.js) (适用于angularjs.js) 在我的例子中,这是当我在127.0.0.1上配置了第二个本地站点“localhost alternative”时。为什么Internet Explorer显示此错误?它可以在Chrome、Edge或Fir

症状:

当通过intranet url在Visual Studio 2015中加载AngularJS时,AngularJS库此时会抛出一个错误:

    line 7:       if(H(b)||Ta(b))
(适用于angularjs.min.js)

(适用于angularjs.js)


在我的例子中,这是当我在127.0.0.1上配置了第二个本地站点“localhost alternative”时。为什么Internet Explorer显示此错误?它可以在Chrome、Edge或Firefox中正常工作。在这些情况下,浏览器不会重新登录本地PC。它会恢复到intranet设置。当Internet Explorer认为您正在浏览Intranet时,它会恢复到IE7渲染引擎。而且Angular说的史前语不太好

决议

您可以在每个响应中发送一些自定义标题。您可以将它们添加到web.config中,如下所示:

    <?xml version="1.0" encoding="utf-8"?>
    <configuration>
      <system.webServer>
        <httpProtocol>
          <customHeaders>
            <add name="X-UA-Compatible" value="IE=edge" />
              ....

....
此标题指示Internet Explorer使用其当前的渲染引擎,因此AngularJS将按其应有的方式进行渲染

    <?xml version="1.0" encoding="utf-8"?>
    <configuration>
      <system.webServer>
        <httpProtocol>
          <customHeaders>
            <add name="X-UA-Compatible" value="IE=edge" />
              ....