angular-ui IE8手风琴

时间:2013-03-20 19:24:23

标签: angularjs angularjs-directive angular-ui angular-ui-bootstrap

使用IE8中的Angular-UI bootstrap手风琴,标签不会扩展。这是我使用IE 8的F12

收到的错误
 Error: Unexpected call to method or property access.undefined 
 Error: No controller: accordion<div class="accordion-group ng-scope" ng-repeat="c in categories" heading="{{c.Name}}"> 
 Error: No controller: accordion<div class="accordion-group ng-scope" ng-repeat="c in categories" heading="{{c.Name}}"> 
 Error: No controller: accordion<div class="accordion-group ng-scope" ng-repeat="c in categories" heading="{{c.Name}}"> 
 Error: No controller: accordion<div class="accordion-group ng-scope" ng-repeat="c in categories" heading="{{c.Name}}"> 
 Error: No controller: accordion<div class="accordion-group ng-scope" ng-repeat="c in categories" heading="{{c.Name}}"> 
 Error: No controller: accordion<div class="accordion-group ng-scope" ng-repeat="c in categories" heading="{{c.Name}}"> 
 Error: No controller: accordion<div class="accordion-group ng-scope" ng-repeat="c in categories" heading="{{c.Name}}"> 
 Error: No controller: accordion<div class="accordion-group ng-scope" ng-repeat="c in categories" heading="{{c.Name}}"> 

有没有人遇到过类似的问题而能够解决问题?

3 个答案:

答案 0 :(得分:6)

看起来主要问题是IE不喜欢使用<accordion>代替<{1}}

答案 1 :(得分:4)

IE8无法识别自定义元素。如果您需要使用accordion指令作为元素而不是属性,则必须定义元素,以便IE不会抱怨。这个简单的脚本可以解决问题。

<script type="text/javascript">
    document.createElement('accordion');
    document.createElement('accordion-group');
    document.createElement('accordion-heading');
</script>

否则,只需在其属性表单中使用该指令。

答案 2 :(得分:1)

我刚刚遇到的另一个问题是你不能把ng控制器放在ie8中与<div accordion>相同的元素上。给我带来了很多的追踪和错误来解决这个问题。

我不得不替换

<div accordion ng-controller="MyCtrl">
    ...
</div>

<div ng-controller="MyCtrl">
    <div accordion>
        ...
    </div>
</div>