javascript - 当我通过任何事件调用 API 时,它会在 ANGULAR 2+ 中滚动窗口顶部?
问题描述
我在一个组件上有一个按钮,可以在这样做时过滤我的表格,因此我正在调用 API。调用 API 后,它会从顶部滚动到窗口。但我希望它应该保持在原来的位置。
注意事项:我没有使用滚动 CSS 或任何 javascript。
.ts 文件
ngOnInit() {
this.type = 'all';
this.getCandidateDetails(this.type);
}
getLoggedInuserDetails(type) {
this.sharedService.getCandidateDetails(type).subscribe(res => {
this.User = res.data;
});
}
getFemaleCandidateDetails(){
this.type = 'female';
this.getCandidateDetails(this.type);
}
.html 文件
<button type="button" class="btn btn-primary" (click)="getFemaleCandidateDetails()">Overall</button>
<table>
// Here I am rendring the data
</table>
解决方案
推荐阅读
- java - 如何使用 selenium webdriver 登录 Salesforce (Chrome) 应用程序并避免身份验证)
- jenkins - 如何在 Jenkins 中进行 Selenium 测试?
- wordpress - 从 wordpress 插件访问 wordpress rest api
- sql - 在 ROW_NUMBER 之后添加 MAX 函数
- statistics - 如何使用超出测量限制的数据计算平均值
- python - 下载 64 位 Python?
- javascript - 如何将 SQL TAB 设置为参考值,以便与 Node-RED 中的另一个选项卡进行比较
- ios - 使用真实设备作为模拟器和存储
- python-2.7 - Matplotlib:如何在多行上对齐文本
- sprite-kit - 在 SpriteKit 中的自定义类上使用 Codable 协议