Angular nested ng-repeat IE8

时间:2015-02-16 08:15:04

标签: angularjs angularjs-ng-repeat angular-ui ui-select2 angularjs-select2

我正在尝试使用angular ng-repeat指令渲染一些JSON数据。它是一个项目数组,每个项目都有标签数组以及其他项目数据。 我正在使用angular-ui / select-ui来用select2渲染标签。 Select2元素使用角度控制器中预定义的可用标记数组(tagList):

<ui-select multiple ng-model="element.tags" ng-change="addTag(element.tags, $index)" theme="select2">
    <ui-select-match ui-lock-choice="$item.locked" placeholder="Add new tag..." value="Add new tag...">
        <div style="color: {{$item.color}};">
            {{$item.label}}
        </div>
    </ui-select-match>
    <ui-select-choices refresh="refreshTags($select.search, element.itemTags, $index)" refresh-delay="0"
                       repeat="tag in tagList[$index] | filter: $select.search">
        <div ng-bind-html="tag.label | filter: $select.search"></div>
        <small>
            {{tag.description}}
        </small>
    </ui-select-choices>
</ui-select>

问题出在IE8中并且不一致:

  • {{tag.description}}和/或tag.label不按角度处理,并按下拉选项列表中的原样打印。
  • 占位符(“添加新标记...”)未在IE8和IE9中呈现

任何帮助将不胜感激! 感谢。

refreshTags:

$scope.refreshTags = function (term, tags, index)
{
    var labels = [];
    $scope.tagList[index] = $scope.tagSource;

    tags.forEach(function (item) {
        labels.push(item.label);
    });

    if (labels.length) {
        $scope.tagList[index] = $scope.tagList[index].filter(function(tag) {
            return labels.indexOf(tag.label) == -1;
        });
    }

    if (term.length) {
        $scope.tagList[index] = $scope.tagList[index].filter(function(tag) {
            return tag.label.indexOf(term) > -1;
        });
    }
};

0 个答案:

没有答案