Reputation: 2633
I want to use ngif to check some int that comes back from a function, and if its bigger then 0 I want to present it, so this is what I did:
<div>
<b>Name:</b>{{person.getName()}}<b>balance left:</b>
<div *ngif="person.getBalance()>0">{{bulk.getBalance()}}</div>
</div>
but i get a blanc page, but if i remove the ngif its fine, but I need it, what am I doing wrong?
this is a data that comes from an array called "person"
tnx
Upvotes: 0
Views: 199
Reputation: 315
You misspelled it. Try removing the * and put a - between ng and if.
<div ng-if="person.getBalance()>0">{{bulk.getBalance()}}</div>
I think that that doesn't work either because you're evaluating a method. Instead store Balance in a variable like this:
<div ng-if="person.balance>0">{{bulk.balance}}</div>
Execute the getBalance method in your controller.
Upvotes: 1