我是Angular 2的新手。尝试使用滚动事件进行其他调用。我有200条记录,最初我会做这样的休息电话Angular 2:滚动事件不会触发
localhost:8080/myapp/records=items&offset=0&limit=50
它将首先获取50条记录。但是,当我向下滚动它再拍API调用获取另外50分的记录,像
localhost:8080/myapp/records=items&offset=50&limit=50
我尝试这样做,但不触发事件。
HTML
<div>
<table class="doc-table" (scrolled)="onScroll($event.value)">
<thead>
<th class="avatar-th"></th>
<th>Id</th>
<th>Name</th>
<th>Price</th>
</thead>
<tbody>
<tr *ngFor="let item of items" (click)="routeTo(item.id)">
<td>{{item.id}}</td>
<td>{{item.name}}</td>
<td>{{item.price}}</td>
</tr>
</tbody>
</table>
</div>
脚本上抵消我必须做出API调用
@Component({
selector: 'item-cmp',
templateUrl: 'items.component.html'
})
export class PatientsComponent(){
onScroll(event:any){
alert("Scolled...");
}
}
基地。帮助我,如何做到这一点?
感谢您的回复。但是,仍然没有工作。 – NNR
很难从这里知道,也许表格不是发出滚动事件的元素。 –
什么是“不工作”的意思。 '$ event.value'应该做什么。据我所知'event'没有'value'属性。 –