javascript - 如何在 Angular 中添加页面刷新
问题描述
我尝试了以下代码。我想在点击游戏路线时添加页面自动刷新。因为当我移动到游戏页面数据没有自动刷新,直到页面重新加载
<mat-list-item routerLink="{{routes.Gamecard}}" routerLinkActive="active">
<mat-icon>games</mat-icon> GAMES
</mat-list-item>
任何人都可以帮助我吗?
谢谢
解决方案
To resolve this problem i know two ways:
- Try to use
[href]="routes.Gamecard"
insteadrouterLink="{{routes.Gamecard}}"
routerLinkActive="active"
, this is the crutch, but, i think this can work. - Create the refresh method in your game-page class, and try to set data in this method by click on your list item, if you are already on the game page.
Are you using ngOnInit
interface? Maybe this is what you need
推荐阅读
- javascript - Laravel刀片文件中Javascript中的范围问题
- sql - 从多个表查询中计算特定表行数
- sql-server - 大型 Fact 表中 NCI dateKey 上的 sql update 语句的最佳实践
- android - Delphi 不会为 android 项目创建 APK
- amazon-web-services - AWS Cognito 托管 UI 和防止并发用户会话
- node.js - SAM Node.js hello world 应用缺少 axios 模块
- sql - 重建所有表中的所有索引但需要排除某些表
- wordpress - 收藏图标仅显示在管理端,不反映在前端
- gitlab - Gitlab CI - 在 before_script 中指定阶段
- aws-sdk - AWS IoT Aanalytics 的数据采集