[Angular 8] Custom Route Preloading with ngx-quicklink and Angular
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的更多相关文章
- [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 ...
- Angular 1 深度解析:脏数据检查与 angular 性能优化
TL;DR 脏检查是一种模型到视图的数据映射机制,由 $apply 或 $digest 触发. 脏检查的范围是整个页面,不受区域或组件划分影响 使用尽量简单的绑定表达式提升脏检查执行速度 尽量减少页面 ...
- angular路由——ui.route
angular路由 使用案例 <!DOCTYPE html> <html lang="en"> <head> <meta charset= ...
- [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 ...
- [Angular] Http Custom Headers and RequestOptions
updatePassenger(passenger: Passenger): Observable<Passenger> { let headers = new Headers({ 'Co ...
- [Angular] Create custom validators for formControl and formGroup
Creating custom validators is easy, just create a class inject AbstractControl. Here is the form we ...
- [Angular 2] Custom Validtors
Create a custom validtor which only accepts the string start with '123'; function skuValidator(contr ...
- [Angular] N things you might don't know about Angular Route
Prevent Partail Page display: By using Resolver: @Injectable() export class MovieResolver implements ...
- 创建自定义路由处理程序(Creating a Custom Route Handler) | 定制路由系统| 高级路由特性 |精通ASP-NET-MVC-5-弗瑞曼
自定义实现 IRouteHandler
随机推荐
- linux服务器搭建lnmp php 微擎环境备用
以前的时候装个php环境各种的配置麻烦啊,于是乎我就像搜搜一键安装php环境,果然 lamp 和phpstudy 两个环境软件都支持,最后发现lamp 还合胃口就选择了lamp https://lnm ...
- Android中使用LitePal操控SQLite数据库
<第一行代码>读书手札 (一)什么是LitePal数据库 LitePal数据库是安卓的一个开源库,我们在以后的开发中,将会遇到许许多多的开源库,感谢开源社 区:因为开源社区的存在,一些我们 ...
- C++_向函数传递对象
向函数传递对象 1. 使用对象作为函数参数 对象可以作为参数传递给函数,其方法与传递其他类型的数据相同. 在向函数传递对象时,是通过传值调用传递给函数的. 因此,函数中对对象的任何修改均不影响调用该函 ...
- Django框架1——视图和URL配置
三个命令 1.创建一个django项目 在cmd中:django-admin.py startproject project_name D:\python\django_site>django- ...
- 从零开始学Flask框架-005
表单 Flask-WTF 项目结构 pip install flask-wtf 为了实现CSRF 保护,Flask-WTF 需要程序设置一个密钥.Flask-WTF 使用这个密钥生成加密令牌,再用令牌 ...
- golang之方法
golang中的方法是作用在指定的数据类型上的(即:和指定 数据类型绑定),因此自定义类型,都可以有方法,而不仅仅是在struct. 方法的使用: type Person struct { Num i ...
- Spring Boot配置文件的加载顺序
配置文件的加载顺序, 后加载的会覆盖先加载的:也就是properties配置文件的内容会替换掉.yml及.yaml文件的内容
- ArcGIS Server Identify结果属性 AliasName
最近做地图服务相关工作,一般在数据库中,字段名有好多限制,而实际工作中,需要显示的经常有一些较长的字段或者包含单位等特殊符号. 为了方便属性的操作,将属性字段名改为英文,AliasName中保存了属性 ...
- Angular Material 学习笔记 Chips
依据 material guidelines, chips 可以用来做 filter https://material.io/design/components/chips.html#filter-c ...
- IClientMessageInspector IDispatchMessageInspector
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.T ...