18.2.1 • Published 9 months ago

@angular-extensions/elements v18.2.1

Weekly downloads
5,809
License
MIT
Repository
github
Last release
9 months ago

ANGULAR EXTENSIONS ELEMENTS

The easiest way to lazy-load Angular Elements or any other web components in your Angular application!

by @tomastrajan

npm npm npm Build Status codecov Conventional Commits Twitter Follow

Documentation

Quickstart

  1. Install npm i @angular-extensions/elements
  2. Add import { LazyElementsModule } from '@angular-extensions/elements';
  3. Append LazyElementsModule to the imports: [] of your AppModule
  4. Add new schemas: [] property with CUSTOM_ELEMENTS_SCHEMA value to @NgModule decorator of your AppModule
  5. Use *axLazyElement directive on an element you wish to load and pass in the url of the element bundle

Example of module implementation...

import { NgModule, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { LazyElementsModule } from '@angular-extensions/elements';

@NgModule({
  schemas: [CUSTOM_ELEMENTS_SCHEMA],
  imports: [BrowserModule, LazyElementsModule],
  declarations: [AppComponent, FeatureComponent],
  bootstrap: [AppComponent],
})
export class AppModule {}

Example of component implementation

import { Component } from '@angular/core';

@Component({
  selector: 'your-org-feature',
  template: `
    <!-- will be lazy loaded and uses standard Angular template bindings -->
    <some-element
      *axLazyElement="elementUrl"
      [data]="data"
      (dataChange)="handleChange($event)"
    >
    </some-element>
  `,
})
export class FeatureComponent {
  elementUrl = 'https://your-org.com/elements/some-element.js';

  data: SomeData;

  handleChange(change: Partial<SomeData>) {
    // ...
  }
}

Supported Angular versions

Library was tested with the following versions of Angular and is meant to be used with the corresponding major version ("@angular/core"": "^15.0.0" with "@angular-extensions/elements": "^15.0.0" ).

  • 9.x (full IVY support, using renderers so careful with SSR)
  • 8.x (partial IVY support, axLazyElement works but axLazyElementDynamic does NOT work with IVY)
  • 7.x
  • 6.x (eg npm i @angular-extensions/elements@^6.0.0)

Internal dep graph

Internal dep graph

Become a contributor

Missing a feature, found bug or typo in docs?

Please, feel free to open an issue or submit a pull request to make this project better for everyone! 🤗

Sponsors

Are you currently working in an enterprise polyrepo environment with many applications and found yourself thinking you could provide so much more value only if you had better overview to plan, track progress and just get things done?

Try Omniboard, the best tool for lead software engineers and architects that helps them to get an overview to drive change in enterprise polyrepo environments by querying and tracking all their code bases!

The free plan let's you get a full overview of all your projects with your first dashboard, tracking up to 3 different things!

18.2.1

9 months ago

18.2.0

11 months ago

18.0.0

11 months ago

18.1.0

11 months ago

17.1.1

1 year ago

17.1.0

1 year ago

17.0.0

2 years ago

16.0.0

2 years ago

15.1.2

2 years ago

15.3.0

2 years ago

15.1.3

2 years ago

15.1.4

2 years ago

15.2.0

2 years ago

14.1.0

3 years ago

13.0.0

4 years ago

12.6.0

4 years ago

12.5.0

4 years ago

12.4.1

4 years ago

12.4.2

4 years ago

12.1.2

4 years ago

12.1.1

4 years ago

12.1.0

4 years ago

12.0.0

4 years ago

11.0.1

5 years ago

10.1.1

5 years ago

10.1.0

5 years ago

8.12.1

5 years ago

10.0.2

5 years ago

10.0.0

5 years ago

10.0.1

5 years ago

9.4.0

5 years ago

9.3.0

5 years ago

10.0.0-alpha.1

5 years ago

9.2.0

5 years ago

8.12.0

5 years ago

7.4.0

5 years ago

9.1.3

5 years ago

9.1.2

5 years ago

9.1.1

5 years ago

9.1.0

5 years ago

8.11.3

5 years ago

9.0.1

5 years ago

9.0.0

5 years ago

8.11.2

6 years ago

6.1.0

6 years ago

8.11.1

6 years ago

8.11.0

6 years ago

8.10.0

6 years ago

8.9.1

6 years ago

7.3.0

6 years ago

8.9.0

6 years ago

8.8.0

6 years ago

8.7.0

6 years ago

8.6.0

6 years ago

7.2.0

6 years ago

8.5.0

6 years ago

8.4.1

6 years ago

8.4.0

6 years ago

7.1.0

6 years ago

8.3.0

6 years ago

8.2.0

6 years ago

8.1.0

6 years ago

8.0.0

6 years ago

7.0.0

6 years ago

0.3.7

6 years ago

0.3.5

6 years ago

0.3.4

6 years ago