resolve方法拿取数据

实现更高速的相应
由于dom渲染太快,数据跟不上dom,刷新后会产生部分空白。
Angular实战学习记录-3
resolve守卫:
进入路由前就把数据准备好。

1、在home目录下新建home.resolve.service.ts(因为是home路由的守卫)
Angular实战学习记录-3
2、将守卫提供到home-routing.module.ts中
Angular实战学习记录-3
3、在home.component.ts中拿到home.resolve.service.ts中的返回值。Angular实战学习记录-3

相关文章:

  • 2022-12-23
  • 2022-02-15
  • 2021-05-09
  • 2021-09-20
  • 2021-07-12
  • 2021-08-13
  • 2022-01-28
  • 2021-05-28
猜你喜欢
  • 2021-05-01
  • 2022-12-23
  • 2021-12-16
  • 2022-02-15
  • 2022-01-25
  • 2021-10-25
  • 2022-12-23
相关资源
相似解决方案