我在角度js中使用ng-repeat绑定表格 这是我的表
<table class="table table-bordered table-hover">
<thead>
<tr>
<th>Sr. no.</th>
<th>Title</th>
<th>Image</th>
<th>Category</th>
<th>PostedOn</th>
<th>Created By</th>
<th>Status</th>
<th>Active Blog</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="obj in PostedBlogList | filter:searchText" ng-show="PostedBlogList.length">
<td>{{$index+1}}</td>
<td><a ng-href="{{'//'+obj.PageUrl }}">{{obj.Title}}</a></td>
<td>
<img style="width:90px" ng-show="obj.Image" src="{{obj.Image}}">
<img style="width:90px" ng-show="!obj.Image" src="/images/mail.png">
</td>
<td>{{obj.CategoryName}}</td>
<td>{{obj.CreatedDate}}</td>
<td>{{obj.FirstName}}({{obj.UserType}})</td>
<td>{{obj.IsActive ? 'Approved ' : 'Pending'}}</td>
<td>
<button class="btn btn-primary waves-effect waves-light" ng-click="ToActiveBlog(obj.Id)" ng-disabled="" ng-bind="btnactivate" type="submit" value="Activate"></button>
</td>
</tr>
<tr ng-show="PostedBlogList.length==0"></tr>
</tbody>
</table>
我根据true和false使用{{obj.IsActive ? 'Approved ' : 'Pending'}}
设置状态。
在下面<td>
我有一个按钮
<button class="btn btn-primary waves-effect waves-light" ng-click="ToActiveBlog(obj.Id)" ng-disabled="" ng-bind="btnactivate" type="submit" value="Activate"></button>
如果我的状态获得批准,如何禁用该按钮?
答案 0 :(得分:1)
您可以启用此ng-disabled="obj.IsActive"
按钮:
<button class="btn btn-primary waves-effect waves-light" ng-click="ToActiveBlog(obj.Id)" ng-disabled="obj.IsActive" ng-bind="btnactivate" type="submit" value="Activate"></button>