ng-repeat在firefox中无法正常工作

时间:2013-07-16 07:54:59

标签: angularjs angularjs-directive angularjs-ng-repeat

<div class="row-fluid" ng-repeat="timeline in timeline_events">
    <div class="span3 span3-min"><p>{{timeline.link}}</p></div>
    <div class="span2 span2-min"><p>{{timeline.other}}</p></div>
    <div class="span2 span2-min"><p>{{timeline.description}}</p></div>
    <div class="span1 span1-min">
        <p>
            <a class='del-timeline' ng-click='delTimeline($index)'>X</a>
        </p>
    </div>
</div>

timeline_events在chrome中呈现完美但在firefox中没有呈现。我已经清除会话并检查了.NO结果。可能是什么问题?

更新:所以我通过ajax request.Firefox访问timeline_events如果我没有渲染任何ng-repeat指令,如果我通过ajax获取值。在chrome和safari中完美工作。任何补救措施??

1 个答案:

答案 0 :(得分:1)

这里是你的代码的JS小提琴,它也应该在firefox中运行:

<div ng-controller='mainCtrl' class="container">
<div class="row-fluid" ng-repeat="timeline in timeline_events">
    <div class="span3 span3-min">
        <p>{{timeline.link}}</p>
    </div>
    <div class="span2 span2-min">
        <p>{{timeline.other}}</p>
    </div>
    <div class="span2 span2-min">
        <p>{{timeline.description}}</p>
    </div>
    <div class="span1 span1-min">
        <p> <a class='del-timeline' ng-click='delTimeline($index)'>X</a>
        </p>
    </div>
</div>

angular.module('myApp', [])
    .controller("mainCtrl", function ($scope) {
    $scope.timeline_events = [{
        link: 'link 1',
        other: 'other 1',
        description: 'description 1'
    }, {
        link: 'link 2',
        other: 'other 2',
        description: 'description 2'
    }, {
        link: 'link 3',
        other: 'other 3',
        description: 'description 3'
    }];
    $scope.delTimeline = function (index) {
        $scope.timeline_events.splice(index, 1);
    };
});

http://jsfiddle.net/alfrescian/5hVmc/

相关问题