在 angularjs 中批准状态时禁用激活按钮
Disable activate button when status is approved in angularjs
我在 angular js 中使用 ng-repeat 绑定 table
这是我的 table
<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>
我正在根据真假使用 {{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>
如何在我的状态被批准后禁用该按钮?
您可以像这样启用按钮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>
我在 angular js 中使用 ng-repeat 绑定 table 这是我的 table
<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>
我正在根据真假使用 {{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>
如何在我的状态被批准后禁用该按钮?
您可以像这样启用按钮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>