我的项目基于Angular 2.0.0,我希望在导航路线时显示服务员(gif或文本),这必须解决这样的数据:
{
path: 'profile',
loadChildren: () => System.import('../profile/profile.module'),
resolve: {
profile: ProfileResolver
},
},
此外,预加载器需要应用于项目中的每个路径。 感谢。
答案 0 :(得分:0)
我会说你可以根据NavigationStart
&amp ;;创建一个能够继续关注路由事件的服务。 NavigationEnd
事件show/hide
根据isLoading
标记值与[hidden]
的组合加载isLoading: bool = false;
constructor(router:Router) {
router.events.subscribe(event:Event => {
if(event instanceof NavigationStart) {
this.isLoading = true;
}
if(event instanceof NavigationCancel || event instanceof NavigationError) {
this.isLoading = false;
}
}
}
。
<强>代码强>
git clone https://github.com/CocoaPods/Specs.git