{"id":15632944,"url":"https://github.com/mgechev/ngx-hover-preload","last_synced_at":"2025-04-12T15:35:06.658Z","repository":{"id":55049540,"uuid":"328520096","full_name":"mgechev/ngx-hover-preload","owner":"mgechev","description":"🖱 Preload Angular lazy-loaded routes on mouse over","archived":false,"fork":false,"pushed_at":"2024-11-27T23:26:31.000Z","size":660,"stargazers_count":175,"open_issues_count":0,"forks_count":6,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-03T18:12:07.882Z","etag":null,"topics":["angular","javascript","prefetching","preloading","typescript","web-performance"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mgechev.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-01-11T01:45:40.000Z","updated_at":"2025-03-09T18:51:00.000Z","dependencies_parsed_at":"2025-01-06T11:24:41.520Z","dependency_job_id":"b0111fac-e5df-4912-b215-bf65c6cf468d","html_url":"https://github.com/mgechev/ngx-hover-preload","commit_stats":{"total_commits":30,"total_committers":2,"mean_commits":15.0,"dds":"0.033333333333333326","last_synced_commit":"bcfd9be48ea9ef47a3cc01caf323f4acd856b39f"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mgechev%2Fngx-hover-preload","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mgechev%2Fngx-hover-preload/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mgechev%2Fngx-hover-preload/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mgechev%2Fngx-hover-preload/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mgechev","download_url":"https://codeload.github.com/mgechev/ngx-hover-preload/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248590086,"owners_count":21129747,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["angular","javascript","prefetching","preloading","typescript","web-performance"],"created_at":"2024-10-03T10:46:01.969Z","updated_at":"2025-04-12T15:35:06.628Z","avatar_url":"https://github.com/mgechev.png","language":"TypeScript","funding_links":[],"categories":["Recently Updated","Third Party Components"],"sub_categories":["[Nov 29, 2024](/content/2024/11/29/README.md)","Router"],"readme":"[![mgechev](https://circleci.com/gh/mgechev/ngx-hover-preload.svg?style=svg)](https://app.circleci.com/pipelines/github/mgechev/ngx-hover-preload)\n\n\u003cp align=\"center\"\u003e\n   \u003cimg src=\"https://github.com/mgechev/ngx-hover-preload/blob/master/assets/ngx-hover-preload.png?raw=true\" width=\"200px\"\u003e\n\u003c/div\u003e\n\n# ngx-hover-preload\n\nThis package exports a `PreloadingStrategy`, which will preload a lazy-loaded route on mouse over a corresponding router link.\n\n## Alternatives\n\nOther preloading strategies:\n- [`ngx-quicklink`](https://github.com/mgechev/ngx-quicklink) - Preloads the modules associated with *all* links visible in the viewport. Quicklink does more aggressive preloading compared to `ngx-hover-preload`, which makes it more network and CPU intensive.\n- [Guess.js](https://github.com/guess-js/guess) - Most advanced preloading strategy, which uses predictive prefetching. At build-time Guess.js compiles a data analytics model and includes it in your production bundle, so that at runtime after each navigation Guess.js prefetches *only* the modules that are likely to be needed next. Guess.js works particularly well with `ngx-hover-preload`, because if the prediction was wrong the preloading mechanism gracefully fallbacks to hover.\n\n## Example\n\nExample is available [here](https://github.com/mgechev/ngx-hover-preload/tree/master/src).\n\n## Usage\n\nInstall the module:\n```\nyarn add ngx-hover-preload\n```\n\n### Standalone\n\nConfigure your app with the correct providers:\n\n```ts\nbootstrapApplication(AppComponent, {\n  providers: [hoverPrefetchProviders, provideRouter(routes, withPreloading(HoverPreloadStrategy))]\n});\n```\n\nMake sure you import the `HoverPrefetchLinkDirective` anywhere you want to enable prefetching.\n\nIn case you want to disable prefetching for a particular route specify:\n\n```ts\n{\n  path: 'foo',\n  data: {\n    preload: false\n  }\n}\n```\n\n### NgModules\n\nImport the `HoverPreloadModule`  in your `AppModule` and your lazy-loaded modules to ensure the required directives are available:\n\n```ts\n// ...\nimport { HoverPreloadModule } from 'ngx-hover-preload';\n\n@NgModule({\n  declarations: [\n    // ...\n  ],\n  imports: [\n    // ...\n    HoverPreloadModule\n  ],\n  bootstrap: [AppComponent]\n})\nexport class AppModule { }\n```\n\n**Make sure you import the `HoverPreloadModule` in all lazy-loaded modules in which you want to have this functionality available**\n\nDon't forget to set the `HoverPreloadStrategy` as your `preloadStrategy`:\n\n```ts\n// ...\nimport { HoverPreloadStrategy } from 'ngx-hover-preload';\n\n@NgModule({\n  // ...\n  imports: [RouterModule.forRoot(routes, { preloadingStrategy: HoverPreloadStrategy })],\n})\nexport class AppModule {} // or AppRoutingModule\n```\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmgechev%2Fngx-hover-preload","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmgechev%2Fngx-hover-preload","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmgechev%2Fngx-hover-preload/lists"}