Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
@klippa/ngx-async-template
Advanced tools
Easily render templates based on the state of a promise: - inactive - pending - success - error
Easily render templates based on the state of a promise:
yarn add @klippa/ngx-async-template
npm install @klippa/ngx-async-template
I recommend importing the module in a generic ui module and then export it from there, so you can use the ngx-async-template everywhere in your app.
import { NgxAsyncTemplateModule } from '@klippa/ngx-async-template';
@NgModule({
imports: [
NgxAsyncTemplateModule,
],
exports: [
NgxAsyncTemplateModule,
],
})
export class UiModule {}
<ngx-async-template [promise]="userPromise">
<ng-template ngx-async-inactive>
loading not yet started
</ng-template>
<ng-template ngx-async-pending>
loading
</ng-template>
<ng-template ngx-async-success let-users="value">
result is {{users}}
</ng-template>
<ng-template ngx-async-error let-myErrors="errorMessages">
something went wrong {{myErrors}}
</ng-template>
<ng-template ngx-async-all let-myState="status">
Always rendered, state is {{myState}}
</ng-template>
</ngx-async-template>
To render templates, use one or more of the following directives on a ng-template
:
ngx-async-inactive
ngx-async-pending
ngx-async-success
ngx-async-error
ngx-async-all
You can extract the value of a successful promise by using let-someVarName="value"
where someVarName
can be any name you want.
To extract errors provided by a promise you can use let-myErrors="errorMessages"
where myErrors
can be any name you want.
You can also extract the status of a promise, which can be helpful if you have a template with multiple directives (<ng-template ngx-async-inactive ngx-async-pending...
) with let-myState="status"
where myState
can be any name you want.
FAQs
Easily render templates based on the state of a promise: - inactive - pending - success - error
The npm package @klippa/ngx-async-template receives a total of 312 weekly downloads. As such, @klippa/ngx-async-template popularity was classified as not popular.
We found that @klippa/ngx-async-template demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers 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.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.