Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

@aiao/lazy-module

aiao12.0.0TypeScript support: included

[![npm][shields-lazy-module]][npm-lazy-module]

readme

@aiao/lazy-module

npm

按需加载 angular module

场景

不用等到路由触发后才加载相应模块,可以由代码控制主动预加载,提高用户体验

安装

yarn add @aiao/lazy-module

版本

lazy-module angular
2.x 16.x
1.x 9 - 15.x

使用

参考 dev-lazy-module

export class AppComponent {
  constructor(private lazyModuleLoader: LazyModuleLoader) {}
  async preload() {
    await this.lazyModuleLoader.load('testModule');
    console.log('preload');
  }
}