Reputation: 6491
I am using ng-repeat to display rows in a table and when two items are not null I want to display true in HTML. I've searched but I can't find an expression or ng directive.
<table class="table table-bordered table-striped">
<thead>
<tr>
<th>Account Enabled?</th>
<th>Username</th>
<th>Date Registered</th>
<th>User Displayname</th>
<th>Password Reset?</th>
<th>Password Valid To</th>
<th>Log On Count</th>
<th>Last Logged On</th>
<th>Is Primary Account?</th>
<th></th>
</tr>
</thead>
<tbody>
<tr data-ng-repeat="item in onlineAccounts.CommunicationMethods">
<td>
{{item.IsEnabled}}
</td>
<td>
{{item.UserName}}
</td>
<td>
{{item.CreatedOn}}
</td>
<td>
{{item.OnlineDisplayName}}
</td>
<td>
{{}}
</td>
<td>
<div ng-if="item.PasswordResetTokenValidTo != null && item.PasswordResetTokenValidTo != null">True</div>
<div ng-if="item.PasswordResetTokenValidTo == null item.PasswordResetTokenValidTo == null">False</div>
</td>
<td>
{{item.LogOnCount}}
</td>
<td>
{{item.LastLoggedOn}}
</td>
<td>
{{item.IsDefault}}
</td>
</tr>
</tbody>
</table>
This is the line I want to change:
<div ng-if="item.PasswordResetTokenValidTo != null && item.PasswordResetTokenValidTo != null">True</div>
<div ng-if="item.PasswordResetTokenValidTo == null item.PasswordResetTokenValidTo == null">False</div>
I get the error:
Error: [$parse:syntax] Syntax Error: Token 'item' is an unexpected token at column 40 of the expression [item.PasswordResetTokenValidTo == null item.PasswordResetTokenValidTo == null] starting at [item.PasswordResetTokenValidTo == null].
Is there any angular guru that can help me out?
Upvotes: 2
Views: 4016
Reputation: 12854
You forgot &&
<div ng-if="item.PasswordResetTokenValidTo == null && item.PasswordResetTokenValidTo == null">False</div>
---------------------------------------------------^^
Upvotes: 5
Reputation: 14017
You forgot &&
<div ng-if="item.PasswordResetTokenValidTo == null && item.PasswordResetTokenValidTo == null">False</div>
Upvotes: 1