2

I understand ng-show/ng-hide can be used but this case is a little different. This is my script below. Basically what I'm trying to do is hide the word "PEAK" if 'info.peak' value is empty in the title tag. DO I need to create two versions of this image tag? One with and without 'peak'? If show How would I do that also?

<img 
class="icon lazyloaded"  
data-ng-src="{{ info.image }}" 
alt="{{ info.title }}"  
title="Last Week: {{ info.lastweek}}  Move: {{ info.move }} Peak: {{ info.peak }}" 
width="100" 
height="100"> 

1 Answers1

3

You can do this with the following:

{{ info.peak ? 'Peak: ' + info.peak : '' }}

in place of where you have Peak: {{ info.peak }}. So if info.peak does not exist/is null, it will simply append an empty string to the end.

georgeawg
  • 48,608
  • 13
  • 72
  • 95
Amethystx87
  • 488
  • 3
  • 6