
Security News
Meet Socket at Black Hat and DEF CON 2025 in Las Vegas
Meet Socket at Black Hat & DEF CON 2025 for 1:1s, insider security talks at Allegiant Stadium, and a private dinner with top minds in software supply chain security.
ngx-cache-if
Advanced tools
Angular *ngIf directive that cache content. *ngxCacheIf directive render content when needed and cache it for reuse.
This directive to fill the gap between legacy *ngIf structural directive and [hidden] directive. ngxCacheIf will behave like a ngIf for the first rendering then will act has hidden/shown directive. This allow to render a component only when needed and keep it's result in cache if we need to hide it again. (conditionnal content).
Tested with :
Framwork | Version |
---|---|
Angular | 5 + |
Ionic | 3 |
npm i --save ngx-cache-if
import NgxCacheIfModule in your app module.
<my-comp async *ngxCacheIf="state"></my-comp>
Url : https://mkligknn.github.stackblitz.io
StackBlitz : https://stackblitz.com/edit/ngx-cache-if
By default ngIf diretive render the component each time you want to display it. And destroy it when you hide it. This cause the lifecycle events to trigger multiple time if you display the same content. (An async call made in ngOnInit for example).
The hidden/shown behaviors renders the element at the rendering of the parent component and hide or display it with css. This cause the lifecycle events to be triggered at the rendering of the parent view. If you have multiples components to load in the same view that can cause a large amount of operations if they are computing all at the same time instead of rendering only when needed.
FAQs
Angular *ngIf directive that cache content. *ngxCacheIf directive render content when needed and cache it for reuse.
The npm package ngx-cache-if receives a total of 92 weekly downloads. As such, ngx-cache-if popularity was classified as not popular.
We found that ngx-cache-if demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Meet Socket at Black Hat & DEF CON 2025 for 1:1s, insider security talks at Allegiant Stadium, and a private dinner with top minds in software supply chain security.
Security News
CAI is a new open source AI framework that automates penetration testing tasks like scanning and exploitation up to 3,600× faster than humans.
Security News
Deno 2.4 brings back bundling, improves dependency updates and telemetry, and makes the runtime more practical for real-world JavaScript projects.