0
我有以下角度:角日期格式,如果条件
ngOnInit(){
this.getInfo().then((data) => {
this.allInfo= data;
});
};
...其中data
看起来象下面这样:
0:
Time: 1508218791131
1:
Time: 1508217179413
2:
Time: 1508217026810
然后,在HTML:
<div *ngFor = "let each of allInfo;" >
<div>{{ each.Time | date : "shortTime" }}</div>
</div>
这些工作很好。
这里就是我想要做:
我想给Time
比作current time
有两个条件:
- 如果它比较了少超过24小时到当前时间,然后用“shortTime”给出
11:10 pm
- 如果它已经被更多比24小时比较到当前时间,然后使用“MMM d”给出
Oct 16
。
如何将if条件添加到ngFor语法里面?