在条件下更改智能表中按钮的颜色

时间:2016-10-05 14:06:29

标签: angularjs smart-table

我想在条件下更改按钮的颜色:单击“添加”按钮时,会出现模态窗口,如果将注释添加到文本区域,我想更改按钮的颜色。单击提交按钮后,将触发休息呼叫。根据成功或失败的反应,我想改变我的按钮颜色。

控制器代码

$scope.colorChange = false;
if(response.resp == 'success'){
    $scope.colorChange = true;
}

.. 现在当“colorChange”变为真时所有行“添加”按钮颜色变化。我希望管理员注释按钮行颜色更改。我用过ng-class ng-class="{'selected':colorChange == true}",但它不起作用,请帮助我。

 .selected {
            background-color: #A52A2A;
            color: #FFFFFF;
           }

...

<table st-table="displayedCollection" st-safe-src="rowCollection" class="st-table table table-custom">
          <thead>
          <tr class="st-filters">
            <th colspan="5" style="padding-right: 30px">
              <input st-search placeholder="Table search" class="input-sm form-control" type="search"/>
            </th>
          </tr>
          <tr>
           <th st-sort="firstName" class="sorting">FirstName</th>
            <th st-sort="lastName" class="sorting">Last Name</th>
            </tr>
          </thead>
          <tbody>
          <tr st-select-row="row"   st-select-mode="multiple" ng-repeat="row in displayedCollection">
          <td >{{row.firstName}}</td>
            <td>{{row.lastName}}</td>
           <td>
              <button class="btn btn-primary mb-8" ng-click="addminComment($event,row)" ng-class="{'selected':colorChange == true}"  data-options="splash-2 splash-ef-12">Add</button>
            </td>
          </tr>
          </tbody>
          <tfoot>
          <tr>
            <td colspan="5" class="text-center">
              <div st-pagination="" st-items-by-page="itemsByPage" st-displayed-pages="7"></div>
            </td>
          </tr>
          </tfoot>
        </table>

0 个答案:

没有答案