ANGULARJS:如果ng-repeat为空,如何添加0?

时间:2018-03-19 15:38:00

标签: angularjs angularjs-ng-repeat

我的表看起来像这样: enter image description here

后面的代码是:

<tr ng-repeat="di in dayInterval track by di.id"
          ng-class="{weekend: di.dayName=='Samedi'|| di.dayName=='Dimanche'}">

          <!--td ng-repeat="pr in profiles track by pr.i.id_profile" ng-if="gr.id_groupe==pr.i.groupe"
          style="min-width:150px !important; max-width:150px !important; height:40px !important;font-size:12px;">

            <!label ng-repeat="ptt in value.ptasks track by ptt.id_profile" ng-if="ptt.id_profile==pr.i.id_profile">
              {{ptt.counter / 2}}
            </label-->

            <td ng-repeat="(key,value) in fullTasks track by value.id_profile" style="min-width:150px !important; max-width:150px !important; height:40px !important;font-size:12px;"
            ng-if="gr.id_groupe==value.groupe">
                <div ng-repeat="d in value.tasks track by $index" ng-if="d.from_interval==di.dsUnix">
                  <a style="color:rgb(0, 102, 255); font-weight:bolder">{{d.counter / 2}} {{d.hrname}}</a>
                </div>
              0

            </td>




          </tr>

如果每个人都没有价值,我该如何为每个人自动生成0值?

1 个答案:

答案 0 :(得分:1)

我通常只是这样做:

<div ng-show="value" ... rest of attrs here></div>
<div ng-show="!value">0</div>