加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > 安全 > 正文

[Angular 8] Custom Route Preloading with ngx-quicklink and A

发布时间:2020-12-17 07:06:36 所属栏目:安全 来源:网络整理
导读:In a?previous lesson we learned about implementing a custom preloading strategy. That gives you a lot of control over which route to preload and which not,whether it is based on the user‘s permissions or some runtime app config. In this l

In a?previous lesson we learned about implementing a custom preloading strategy. That gives you a lot of control over which route to preload and which not,whether it is based on the user‘s permissions or some runtime app config. In this lesson we‘re using?ngx-quicklink,a library that drastically simplifies the custom preloading,by automatically loading all visible links on the page.

?

Install:

npm install --save ngx-quicklink

?

Load the module:

import { QuicklinkStrategy,QuicklinkModule } from ngx-quicklink;

@NgModule({
  declarations: [AppComponent,HomeComponent],imports: [
    BrowserModule,MatSidenavModule,BrowserAnimationsModule,QuicklinkModule,RouterModule.forRoot(
      [
        {
          path: ‘‘,component: HomeComponent
        },{
          path: nyan,loadChildren: () =>
            import(./nyan/nyan.module).then(m => m.NyanModule)
        },{
          path: about,loadChildren: () =>
            import(./about/about.module).then(m => m.AboutModule)
        }
      ],{
        preloadingStrategy: QuicklinkStrategy //PreloadAllModules
      }
    )
  ],providers: [],bootstrap: [AppComponent]
})

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读