ngx-hover-preload-v2
TypeScript icon, indicating that this package has built-in type declarations

1.0.0 • Public • Published

ngx-hover-preload-v2

Netlify Status

Npm package version Npm package license Npm downloads total

GitHub latest commit

Based on ngx-hover-preload


This package exports:

  1. PreloadingStrategy, which will preload a lazy-loaded route on mouse over a corresponding router link.
  2. PreloadOnDemandService, which can be used to directly load a module that contains a given route path.

Example

Example code available here

Example running here

Usage

  1. Install the package:
npm install --save ngx-hover-preload-v2
  1. Import the HoverPreloadModule into your AppModule AND your lazy-loaded modules to ensure the link hover directive is available:
// ...
import { HoverPreloadModule } from 'ngx-hover-preload-v2';

@NgModule({
  declarations: [
    // ...
  ],
  imports: [
    // ...
    HoverPreloadModule
  ],
  bootstrap: [AppComponent]
})
export class AppModule { }
  1. Set your RouteModule preload strategy to HoverPreloadStrategy:
// ...
import { HoverPreloadStrategy } from 'ngx-hover-preload-v2';

@NgModule({
  // ...
  imports: [RouterModule.forRoot(routes, { preloadingStrategy: HoverPreloadStrategy })],
})
export class AppModule {} // or AppRoutingModule

License

MIT

Package Sidebar

Install

npm i ngx-hover-preload-v2

Weekly Downloads

4

Version

1.0.0

License

MIT

Unpacked Size

58.9 kB

Total Files

18

Last publish

Collaborators

  • danevanderbilt