延迟浏览到下一页 [英] Delay navigating to next page

查看:67
本文介绍了延迟浏览到下一页的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的角度站点效果很好,但是当您click进入项目时,它会立即加载页面,有时从 API 中提取图像时会出现flashid,如1秒延迟或页面过渡效果.

My angular site works great, but when you click into a project it loads the page, right away and sometimes there is a flash while the images are pulled from the API, id like a 1 second delay, or page transition effect.

但是我不确定如何在Angular 2中实现这一点.有兴趣听听其他人在做什么吗?

but i'm not sure how to implement this in Angular 2. Interested to hear what others are doing ?

预先感谢

推荐答案

您可以实现

You can implement CanDeactivate interface, something like this:

routerCanDeactivate(currTree?: RouteTree, futureTree?: RouteTree): Promise <boolean> {
  return new Promise((resolve, reject) => {
    setTimeout(() => resolve(true), 1000);
  })
}

这篇关于延迟浏览到下一页的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆