首页 > 解决方案 > Reverse function strange behaviour when scroll

问题描述

I have this typescript code :

get history() {
    return this.isCollapsed
        ? this.service.history.reverse().slice(0, this.SHOW)
        : this.service.history.reverse();
}

In template :

<div *ngFor="let histor of history">
   <div{{ histor.name }}</div>
   </div>
</div>

The problem is that when I scroll these 2 items that exist in history are changed with the place, and I get a kind of freezing. So strange behaviour. Is the reverse method the cause of that ? Thx in advance and sorry for my english.

标签: angulartypescriptangular7

解决方案


推荐阅读