4

I have table that is populating a list using angularjs controller. How can I show a place holder(say a dash sign) if the place expression is null or undefined??

Here is a snippet.

enter image description here

I am populating the view as:

<td>{{trans.Status}}</td>
<td>{{trans.PaymentId}}</td>
<td>{{trans.TransId}}</td>

I found about ng-show in angular docs. But I really don't want to use an extra span under td as this

<span class="empty" ng-show="!trans.TransId">N/A</span>

Is there any better way to do this.

Language Lassi
  • 2,520
  • 21
  • 24

1 Answers1

8

You can do the following:

<td>{{trans.Status}}</td>
<td>{{trans.PaymentId}}</td>
<td>{{trans.TransId || 'N\A'}}</td>
GPicazo
  • 6,516
  • 3
  • 21
  • 24