2

I have this piece of code that is working fine and displays the data as per received from controller into the binding. However, I tried to make server data as string.empty and I was expecting this default text "Your name" would appear, and it is not. I want the default text to be shown if server returns empty string.

<label for="name" class="label-proj" ng-bind="ctrl.name">Your name</label>
Jasmine
  • 5,186
  • 16
  • 62
  • 114

1 Answers1

6

You could do the following:

<label for="name" class="label-proj">{{ctrl.name || "Your name"}}</label>
Passersby
  • 1,092
  • 9
  • 11