0

我有一个简单的 ng-repeat 循环遍历带有金融存款列表的 JSON 文件。

但是,我正在尝试对前 12 个条目进行切片并对值执行 ng-switch:

HTML:

<td ng-repeat="deposit in MyData.MyDeposits.slice(0, 12)" ng-switch="WHATGOESHERE?">
    <span ng-switch-when="0">U</span>
    <span ng-switch-when="1">D</span>
    <span ng-switch-when="2">2</span>
    <span ng-switch-when="3">3</span>
    <span ng-switch-when="4" class="icon-warning">3</span>
</td>

JS:

function EventController($scope) {
    $scope.MyData = {
        "Name" : "Mr White",
        "MyDeposits": [
                "0",
                "0",
                "0",
                "U",
                "1",
                "2",
                "4",
                "0",
                "D",
                " ",
                " ",
                " ",
                " ",
                " ",
                " ",
                " ",
                " ",
                " ",
                " ",
                " ",
                " ",
                " "
         ];
    }
};

我面临的问题是我在我的ng-switch="WHATGOESHERE?"


添加 plunker:http ://plnkr.co/edit/WtFWVYVvRKm1pN19qlX8?p=preview

4

0 回答 0