AngularJS在IE8中的错误 [英] AngularJS errors in IE8

查看:357
本文介绍了AngularJS在IE8中的错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正与一个新的角度应用工作,需要对IE8它向后兼容。从它看起来像它装载在我的路由信息​​,加载模板(一个点),但在检测控制台日志,我看到下面的错误。

I am working with a new angular app and need to make it backward compatible to IE8. From what it looks like it loads in my routing info, loads the template (to a point) but in the concole log i see the following error.

类型错误:对象不支持此属性或方法< D​​IV
  类= NG-范围NG-视图>

TypeError: Object doesn't support this property or method <div class=ng-scope ng-view>

这是我的索引HTML页面的样子:

This is what my index html page looks like:

<!DOCTYPE html>
<html id="ng-app" ng-app="app">
    <head>
        <!--Add dependencies-->
        <script src="jquery.min.js"></script>
        <link rel="stylesheet" src="bootstrap.min.css" />
        <script src="angular.min.js"></script>
        <script src="angular-route.js"></script>
        <script src="ui-bootstrap.js"></script>
        <script type="text/javascript">
            document.createElement('header');
            document.createElement('nav');
            document.createElement('menu');
            document.createElement('section');
            document.createElement('article');
            document.createElement('aside');
            document.createElement('footer');
        </script>
    </head>
    <body>
        <div id="wrapper">
            <header class="header header-fixed">
                <section class="navbar navbar-inverse docs-navbar-primary">
                    <div class="container">
                        <div class="row">
                            <div class="col-md-7" style="color:white; margin-top:14px;">Thinflash: Fullscreen Demo</div>
                        </div>
                    </div>
                </section>
            </header>
            <section role="main" class="container main-body">
                <div ng-view></div>
            </section>
            <!--Add AngularJs Files-->
            <script src="swfObject.js"></script>
            <script src="app.js"></script>
            <script src="appControllers.js"></script>
            <script src="thinflash.js"></script>
        </div>
    </body>
</html>

Template.html:

Template.html :

<div ng-controller="thinflash.controllers.playback">
    <div ng-controller="app.controllers.fullscreen">
        <div class="mainWrapper" id="stageWrapper">
            <label>SWF Object Display </label>
            <div class="swfWrapper" style="width:320px; height:240px;" id="swfStage">
                <div class="tf-container" tf-swf tf-interface="flashInterface" tf-src="thin.swf" tf-min-version="11.0.0"></div>
            </div>
        </div>

        <div class="col-md-5">
             <form role="form">
                 <!-- Video Playback Controls -->
                 <div class="row">
                     <div class="form-group col-md-7">
                         <label>Select Preloaded Video:</label> 
                         <select class="form-control" ng-model="myVideo" ng-init="myVideo = videos[2]" ng-change="changeVideo(myVideo)" ng-options="v for v in videos"><option></option></select>
                     </div>
                </div>

                <div class="row">
                    <div class="form-group col-md-7">
                        <button type="button" class="btn btn-primary" ng-click="pausePlaybackToggle()">Pause</button>
                        <button type="button" class="btn btn-primary" ng-click="playVideo()">Play</button>
                    </div>
                </div>

                <div class="row">
                    <div class="form-group col-md-7">
                        <label>Volume Control:</label> 
                        <input style="width:50%;" type="range" id="slider" min="1" max="100" step="1" ng-model="volume" ng-change="changeVolume()">
                    </div>
                </div>

                <div class="row">
                    <div class="form-group col-md-8">
                        <label>Size Controls:</label><br/> 
                        <button type="button" class="btn btn-primary" ng-click="changeVideoSize(1)">Small</button>
                        <button type="button" class="btn btn-primary" ng-click="changeVideoSize(2)">Medium</button>
                        <button type="button" class="btn btn-primary" ng-click="changeVideoSize(3)">Large</button>
                    </div>
                </div>
            </form>
        </div>
    </div>
</div>

再在IE8的应用程序加载出现时,模板负载(或启动太...但我得到这个错误)

Again when the app loads in IE8 it appears that the template loads (or starts too ... but i get this error)

推荐答案

使用类似 html5shiv 添加IE8 HTML5支持或这个小片段:

Add html5 support for IE8 by using something like html5shiv or this little snippet:

<script type="text/javascript">
  document.createElement('header');
  document.createElement('nav');
  document.createElement('menu');
  document.createElement('section');
  document.createElement('article');
  document.createElement('aside');
  document.createElement('footer');
</script>

修改

修复的对象不支持此方法或属性IE可以是一个野兽,因为它是不会告诉你任何东西。它不会告诉你什么的目标,它不会告诉你什么的属性,它不会告诉你什么方式并最糟糕的是它不会告诉你< STRONG>其中,这实际上发生了。看到这个模式?有效的它说;的坏事发生了什么地方,去图的。这是原因之一,为什么每个人的的IE浏览器。

Edit

Fixing an "Object does not support this method or property" on IE can be a beast, cause it isn't telling you anything. It's not telling you what object, it's not telling you what property, it's not telling you what method and worst of all it's not telling you where this actually occurred. See the pattern? Effectively it's saying; something bad has happened somewhere, go figure. This is one of the reasons why everyone loves IE.

添加上面的代码可能已经解决的问题,但是另一个问题弹出,产生同样辉煌的错误消息。通过张贴每个新涉足的一块修复错误消息的这个痕迹冒险的 HTML 的可能需要很长的时间,而应与IE的服务台进行讨论。的他们有一个应答机告诉你升级到的其他问题的他们的新蹩脚的框。通过故障排除此#1的问题是喜欢拍摄的卫星在天空外面有水的手枪,在黑暗中,蒙住眼睛,喝醉了。

Adding the above snippet has probably solved a problem but then another problem popped up, which produced the same brilliant error message. Fixing this breadcrumb adventure of error messages by posting each new involved piece of html can take a very long time and should rather be discussed with the helpdesk of IE. They have an answering machine telling you to upgrade to their new crappy box of other issues. Troubleshooting this problem via Stackoverflow is like shooting satellites out of the sky with a water pistol, in the dark, blindfolded and drunk.

一些其他的事情,你可能会考虑:

Some other things you might consider:


  • 将片段以上述任何其他脚本包含

  • 与html5shiv替换段

  • 降级版本包含AngularJS。 1.1.5版似乎对IE7工作。 1.3版不支持IE8的。

  • 检查角IE兼容性
  • 的引导线
  • 开始评论code(JavaScript的/ HTML),以更好地隔离导致该问题的部分。请记住,多个问题产生的同样的错误在IE 消息。

  • 升级到其他问题上的新蹩脚的框。

这篇关于AngularJS在IE8中的错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆