I want to compare number in an ngIf and depending on the result i'll display something.
<div>
<div *ngIf="number(user.number)>59">
{{ number(user.number) }}
</div>
<div *ngIf="number(user.number)<60">
{{ number(user.number) }}
</div>
</div>
my number.ts
number ( date: Date) {
const now = new Date().getFullYear()
const diff = Math.abs(now - new Date(date).getFullYear())
console.log(diff)
return diff
}
it will return a number
This is not working i think there's a problem with ">" & "<" operator, is there a way to make it work ?
See Question&Answers more detail:os