Socket
Socket
Sign inDemoInstall

ng-lazy-load-component

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ng-lazy-load-component - npm Package Compare versions

Comparing version 15.0.1 to 15.0.2

18

lib/ng-lazy-load-component.component.d.ts
import { Injector, Type, EventEmitter, OnDestroy, OnChanges, SimpleChanges } from '@angular/core';
import * as i0 from "@angular/core";
export declare type LazyImporter = () => Promise<{
module: Type<any>;
export declare type NgLazyLoadComponentImporter = () => Promise<{
module?: Type<any>;
component: Type<any>;
injector?: Injector;
}>;
export declare type NgLazyLoadComponentOutput = {
property: string;
value: any;
};
export declare class NgLazyLoadComponentComponent implements OnDestroy, OnChanges {
private injector;
private vcRef;
lazyImporter: LazyImporter;
lazyImporter: NgLazyLoadComponentImporter;
private _componentInput;
set componentInput(value: Record<string, any>);
componentOutput: EventEmitter<{
property: string;
value: any;
}>;
componentOutput: EventEmitter<NgLazyLoadComponentOutput>;
protected isLoading: boolean;

@@ -24,3 +26,3 @@ protected error: boolean;

ngOnChanges(changes: SimpleChanges): void;
load(lazyImporter: LazyImporter): Promise<void>;
load(lazyImporter: NgLazyLoadComponentImporter): Promise<void>;
private setInput;

@@ -27,0 +29,0 @@ private setOutput;

{
"name": "ng-lazy-load-component",
"version": "15.0.1",
"version": "15.0.2",
"description": "Angular pipe and directive for type casting template variables.",

@@ -5,0 +5,0 @@ "repository": {

# NgLazyLoadComponent [![Build Status](https://app.travis-ci.com/nigrosimone/ng-lazy-load-component.svg?branch=main)](https://app.travis-ci.com/nigrosimone/ng-lazy-load-component) [![Coverage Status](https://coveralls.io/repos/github/nigrosimone/ng-lazy-load-component/badge.svg?branch=main)](https://coveralls.io/github/nigrosimone/ng-lazy-load-component?branch=main) [![NPM version](https://img.shields.io/npm/v/ng-lazy-load-component.svg)](https://www.npmjs.com/package/ng-lazy-load-component)
Angular lazy load component into HTML template.
Lazy load Angular component into HTML template.
## Description
Angular lazy load component into HTML template.
This library help to lazy load Angular component dynamically and render a at runtime. The `NgLazyLoadComponent` takes a function named lazyImporter as an input, which returns a Promise containing the component to be loaded.

@@ -37,3 +37,2 @@ See the [stackblitz demo](https://stackblitz.com/edit/demo-ng-lazy-load-component?file=src%2Fapp%2Fapp.component.ts).

],
providers: [],
bootstrap: [AppComponent],

@@ -45,3 +44,3 @@ ],

*Step 2*: The component to lazy load
*Step 2*: This is `test-lazy.ts` an example of component with `NgModule` to lazy load (but also works with standalone component), eg.:

@@ -57,8 +56,8 @@ ```ts

Input2: {{testInput2}} <button (click)="testOutput2.emit(testInput2)">Output2</button>
`,
`
})
export class TestLazyComponent {
@Input() testInput1 = 0;
@Input() testInput2 = 0;
@Output() testOutput1: EventEmitter<number> = new EventEmitter<number>();
@Input() testInput2 = 0;
@Output() testOutput2: EventEmitter<number> = new EventEmitter<number>();

@@ -73,5 +72,2 @@ }

export class TestLazyModule {}
// Export the component
export const testLazyComponent = TestLazyComponent;
```

@@ -83,2 +79,3 @@

import { Component } from '@angular/core';
import { NgLazyLoadComponentImporter, NgLazyLoadComponentOutput } from 'ng-lazy-load-component';

@@ -99,13 +96,11 @@ @Component({

lazyImporter = (): Promise<{ module: Type<any>, component: Type<any> }> => import('./test-lazy.module').then((m) => ({
module: m.TestLazyModule,
component: m.testLazyComponent
lazyImporter: NgLazyLoadComponentImporter = () => import('./test-lazy').then((m) => ({
component: m.TestLazyComponent, // Also works with standalone component
module: m.TestLazyModule // NgModule is optional!
}));
onComponentOutput(event: { property: string, value: number }) {
onComponentOutput(event: NgLazyLoadComponentOutput) {
switch (event.property) {
case 'testOutput1': this.testInput1 = event.value + 1; break;
case 'testOutput2': this.testInput2 = event.value + 1; break;
default:
break;
}

@@ -112,0 +107,0 @@ }

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc