【问题标题】:ng-switch-when value from an ng-repeat not displaying valueng-switch-when 来自 ng-repeat 的值不显示值
【发布时间】:2012-09-03 03:27:29
【问题描述】:

我有这个简单的代码。问题是"ng-switch-when" 未显示,这意味着column.stage 未正确呈现,尽管我尝试显示{{column.stage}} 并显示正确的值(1 OR 2 OR 3...)

<div class="column span3" ng-repeat="column in columns">
    <h1>{{column.title}}</h1>
    <div class="row" ng-repeat="shot in shots" ng-switch on="shot.stage">
        <h6 ng-switch-when="{{column.stage}}">{{shot.title}}</h6>
    </div>
</div>

【问题讨论】:

    标签: angularjs javascript-framework


    【解决方案1】:

    您需要将 ng-switch on="shot.stage" 放在它自己的元素中,例如:

    <div class="column span3" ng-repeat="column in columns">
        <h1>{{column.title}}</h1>
        <div class="row" ng-repeat="shot in shots">
            <div ng-switch on="shot.stage">
              <h6 ng-switch-when="{{column.stage}}">{{shot.title}}</h6>
            </div>
        </div>
    </div>
    

    【讨论】:

    • 我认为我们不能将变量放在ng-switch-when。不幸的是。
    猜你喜欢
    • 2014-06-23
    • 2013-06-30
    • 1970-01-01
    • 2017-04-15
    • 2013-11-23
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多