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]
})

[Angular 8] Custom Route Preloading with ngx-quicklink and Angular的更多相关文章

  1. [Angular] Read Custom HTTP Headers Sent by the Server in Angular

    By default the response body doesn’t contain all the data that might be needed in your app. Your ser ...

  2. Angular 1 深度解析:脏数据检查与 angular 性能优化

    TL;DR 脏检查是一种模型到视图的数据映射机制,由 $apply 或 $digest 触发. 脏检查的范围是整个页面,不受区域或组件划分影响 使用尽量简单的绑定表达式提升脏检查执行速度 尽量减少页面 ...

  3. angular路由——ui.route

    angular路由 使用案例 <!DOCTYPE html> <html lang="en"> <head> <meta charset= ...

  4. [Angular] Create a custom validator for template driven forms in Angular

    User input validation is a core part of creating proper HTML forms. Form validators not only help yo ...

  5. [Angular] Http Custom Headers and RequestOptions

    updatePassenger(passenger: Passenger): Observable<Passenger> { let headers = new Headers({ 'Co ...

  6. [Angular] Create custom validators for formControl and formGroup

    Creating custom validators is easy, just create a class inject AbstractControl. Here is the form we ...

  7. [Angular 2] Custom Validtors

    Create a custom validtor which only accepts the string start with '123'; function skuValidator(contr ...

  8. [Angular] N things you might don't know about Angular Route

    Prevent Partail Page display: By using Resolver: @Injectable() export class MovieResolver implements ...

  9. 创建自定义路由处理程序(Creating a Custom Route Handler) | 定制路由系统| 高级路由特性 |精通ASP-NET-MVC-5-弗瑞曼

    自定义实现 IRouteHandler

随机推荐

  1. 用Gson实现json与对象、list集合之间的相互转化

    先写一个Person实体类,导入Gson包 String jsonData="{\"userid\":\"1881140130\"}";// ...

  2. EAFP vs LBYL

    EAFP vs LBYL 检查数据可以让程序更健壮,用术语来说就是防御性编程.检查数据的时候,有EAFP和LBYL两种不同的编程风格,具体的意思如下: LBYL: Look Before You Le ...

  3. PAT(A) 1148 Werewolf - Simple Version(Java)逻辑推理

    题目链接:1148 Werewolf - Simple Version (20 point(s)) Description Werewolf(狼人杀) is a game in which the p ...

  4. WUSTOJ 1304: 最大最小公倍数(Java)

    题目链接:

  5. Git和Github的介绍、简单操作、冲突(上)

    目的:   1.git与github简介  2.Git与SVN区别 3.Github 的简单使用 4.下载安装Git-20-64-bit.exe   5.Git常用命令 5.1Git命令使用场景 5. ...

  6. 代码质量控制 & 编程注意项

    目录 代码质量控制 编程注意项 代码&功能优化 代码优化 功能&模块优化 其他 小技巧 调试 用于记录工作中出现的问题和编程时需要注意的重点,保证代码质量和编程效率     代码质量控 ...

  7. Spring高级进阶:BeanFactoryPostProcessor

    BeanFactoryPostProcessor是实现spring容器功能扩展的重要接口,例如修改bean属性值,实现bean动态代理等.很多框架都是通过此接口实现对spring容器的扩展,例如myb ...

  8. LeetCode每日一练(1-3)

    题目导航 1. 两数之和 2. 两数相加 3. 无重复字符的最长子串 1. 两数之和 给定一个整数数组 nums 和一个目标值 target,请你在该数组中找出和为目标值的那 两个 整数,并返回他们的 ...

  9. 【转载】Sqlserver根据生日计算年龄

    在Sqlserver中,可以根据存储的出生年月字段计算出该用户的当前年龄信息,主要使用到DateDiff函数来实现.DateDiff函数的格式为DATEDIFF(datepart,startdate, ...

  10. 打印html页面

    // 打印类属性.方法定义 const Print = function (dom, options) { if (!(this instanceof Print)) return new Print ...