小编tjf*_*jfo的帖子

根据angular.js中的变量值更改ng-hide

我是angular.js的新手,并继承了代码.有一个使用ng-repeat显示的数据集(customerType).仅当customerType.type等于"new"时,我才想显示3个表行.这三行在下面各自的标签中都有"ng-hide =".我如何在angular.js中执行此操作?我看到的指令似乎都适用于整个屏幕显示,所以我不知道如何仅为部分显示更改范围变量.这是html:

<div ng-repeat="customerType in customerTypes" class="span6">
  <table class="table table-bordered table-striped">
    <thead>
      <tr>
        <th colspan="3">
          <div class="span11 centered-text">
              {{customerType.title}}
          </div>
          <div class="span1">
              <a href="javascript:void(0);" ng-click="pullDetail(customerType.type, customerType.clients)" title="Details"><i class="icon-list-alt"></i></a>
          </div>
        </th>
      </tr>
      <tr>
        <th></th>
        <th>
          <div class="centered-text">
            Month Selected
          </div>
        </th>
        <th>
          <div class="centered-text">
            YTD
          </div>
        </th>
      </tr>                             
    </thead>
    <tbody>
      <tr>
        <td>Revenue</td>
        <td>{{customerType.month.revenue}}</td>
        <td>{{customerType.ytd.revenue}}</td>
      </tr>
      <tr>
        <td>Gross Profit</td>
        <td>{{customerType.month.gross}}</td>
        <td>{{customerType.ytd.gross}}</td>
      </tr>
      <tr>
        <td># of Customers</td>
        <td>{{customerType.month.customers}}</td>
        <td>{{customerType.ytd.customers}}</td>
      </tr>
      <tr>
        <td>Avg GP per Customer</td>
        <td>{{customerType.month.avg_gp}}</td>
        <td>{{customerType.ytd.avg_gp}}</td>
      </tr>
      <tr>
        <td># of Jobs</td>
        <td>{{customerType.month.jobs}}</td> …
Run Code Online (Sandbox Code Playgroud)

angularjs

9
推荐指数
1
解决办法
3万
查看次数

标签 统计

angularjs ×1