2016-12-16 88 views
0

我得到的數據,在這裏用NG-重複填充它放在桌子是我的表如何NG重複的值比較angularjs

<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}} 
     </td> 
     <td> 
      <button class="btn btn-primary waves-effect waves-light" ng-click="ToActiveBlog(obj.Id)" ng-bind="btnactivate" type="submit" value="Activate"></button> 
     </td> 
     </tr> 
     <tr ng-show="PostedBlogList.length==0"> 
     </tr> 
    </tbody> 
</table> 

在狀態行我正在狀態true{{obj.IsActive}}

那麼如何檢查{{obj.IsActive}}是否爲真,然後設置「Approved」 ,如果{{obj.IsActive}}爲假,則設置值「Pending」。

回答

3

整蠱使用三元操作這樣

<td> 
    {{obj.IsActive ? 'Approved ' : 'Pending'}} 
</td>