javascript - 如何刷新角度组件
问题描述
我正在使用ionic 4
两种语言构建一个移动应用程序,ar
并且en
菜单抽屉是一个预构建的组件。
所以我需要刷新抽屉组件以根据 dom 方向rtl
或ltr
我现在正在做的只是location.reload
重新加载整个应用程序,但我认为这不是一个好方法
解决方案
最简单的方法是调用 ngOnInit 类似
fn() {
this.ngOnInit();
}
或者试试这个
this.router.navigateByUrl('/RefreshComponent', { skipLocationChange: true })
.then(() => {
this.router.navigate(['Your actualComponent']);
});
推荐阅读
- php - 为什么我的 wordpress 插件没有显示侧边栏?
- wpf - 为大数据打开弹出窗口的最佳方法
- counter - 在LabVIEW中初始化计数器
- javascript - 如何从指向 json 的 url 获取对象的 JavaScript 数组?
- angular - 使用 Nrwl 的 Nx 中的数据持久性模块,悲观更新的实现与乐观更新有何不同
- canvas - 循环播放随机影片剪辑的功能
- scala - Scala 向 List[Map[String,Double]] 的每个元素插入新键
- cordova - 通过创建自定义插件在 ionic 3 应用程序中添加 AAR 文件
- wpf - 使用 CommandManager 时对 ICommand.CanExecute 进行单元测试
- db2 - 如何打破db2数据库中的循环