
Product
Rust Support Now in Beta
Socket's Rust support is moving to Beta: all users can scan Cargo projects and generate SBOMs, including Cargo.toml-only crates, with Rust-aware supply chain checks.
@ngx-utilities/ngx-if-else-loading
Advanced tools
[](https://www.npmjs.com/package/@ngx-utilities/ngx-if-else-loading)
The *ngxIfElseLoading
directive is a drop-in replacement for *ngIf
that shows a loading
animation while the condition is falsy (i.e. while content is loading).
To install this library, run:
npm install @ngx-utilities/ngx-if-else-loading --save
-or- yarn add @ngx-utilities/ngx-if-else-loading
and then import and export NgxIfElseLoadingModule
in your Angular SharedModule
:
// shared.module.ts
import { NgxIfElseLoadingModule } from '@ngx-utilities/ngx-if-else-loading';
@NgModule({
imports: [
NgxIfElseLoadingModule
],
exports: [
NgxIfElseLoadingModule
]
})
export class SharedModule { }
You can provide a custom loading component. It can be anything you want, it just has to accept
a message
input. If your custom loading component is named MyLoadingComponent
, the setup will
look like this:
// shared.module.ts
@NgModule({
imports: [
NgxIfElseLoadingModule.withCustomLoadingComponent(MyLoadingComponent)
],
declarations: [
MyLoadingComponent
],
entryComponents: [
MyLoadingComponent
]
exports: [
NgxIfElseLoadingModule
]
})
export class SharedModule { }
<ng-container *ngxIfElseLoading="items | async; let items">
...content
</ng-container>
<ng-container *ngxIfElseLoading="items | async; let items; withMessage 'Loading items...'">
...content
</ng-container>
MIT © Kevin Phelps
FAQs
[](https://www.npmjs.com/package/@ngx-utilities/ngx-if-else-loading)
We found that @ngx-utilities/ngx-if-else-loading 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.
Product
Socket's Rust support is moving to Beta: all users can scan Cargo projects and generate SBOMs, including Cargo.toml-only crates, with Rust-aware supply chain checks.
Product
Socket Fix 2.0 brings targeted CVE remediation, smarter upgrade planning, and broader ecosystem support to help developers get to zero alerts.
Security News
Socket CEO Feross Aboukhadijeh joins Risky Business Weekly to unpack recent npm phishing attacks, their limited impact, and the risks if attackers get smarter.