neridaj
neridaj

Reputation: 2183

Angular comparing value to 'null' inside template

I have some data returned with 'null' (string) as the value for an attribute. In the template I'm using ng-if to show 'No Info' if the value === 'null' but it's not being displayed when the value is in fact 'null'. Not sure what's going on.

<span ng-if="item.name !== 'null'"><span>{{item.name}}</span>
<span ng-if="item.name === 'null'" translate="{{'locales.no_info'}}"></span>

Upvotes: 0

Views: 219

Answers (1)

Tim Harker
Tim Harker

Reputation: 2407

You're missing a closing tag, </span>. So that is why it's not being displayed when the value is in fact 'null'!

Upvotes: 3

Related Questions