Delay navigating to next page

痴心易碎 提交于 2019-12-20 02:13:57

问题


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.

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

Thanks in advance


回答1:


You can implement CanDeactivate interface, something like this:

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


来源:https://stackoverflow.com/questions/37710936/delay-navigating-to-next-page

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!