@angular-extensions/elements

中文文档
22.0.0发布于 2026/08/21MITTypeScriptES Module构建来源已验证近 30 天下载 7万

原始使用文档
文档目录7 节
  1. The easiest way to lazy-load Angular Elements or any other …
  2. Documentation
  3. Quickstart
  4. Supported Angular versions
  5. Internal dep graph
  6. Become a contributor
  7. Sponsors

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 { LazyElementDirective } from '@angular-extensions/elements';
  3. Append LazyElementDirective to the imports: [] of your MyOrgComponent
  4. Add new schemas: [] property with CUSTOM_ELEMENTS_SCHEMA value to @Component decorator of your MyOrgComponent
  5. Use *axLazyElement directive on an element you wish to load and pass in the url of the element bundle

Example of component implementation

import { Component, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import { LazyElementDirective } from '@angular-extensions/elements';

@Component({
  selector: 'your-org-feature',
  imports: [LazyElementDirective],
  schemas: [CUSTOM_ELEMENTS_SCHEMA],
  template: `
    <!-- will be lazy loaded and uses standard Angular template bindings -->
    <some-element
      *axLazyElement="elementUrl"
      [data]="data"
      (dataChange)="handleChange($event)"
    ></some-element>
  `,
})
export class MyOrgComponent {
  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! 🤗

Tomas Trajan
Tomas Trajan

💻 🎨 💡 📖 🤔 🚇 ⚠️
Artur Androsovych
Artur Androsovych

💻 🐛
Wayne Maurer
Wayne Maurer

🐛 💻
Santosh Yadav
Santosh Yadav

💻 📦
David Dal Busco
David Dal Busco

💻 💡
Zama Khan Mohammed
Zama Khan Mohammed

💻 🤔 ⚠️
Angel Fraga Parodi
Angel Fraga Parodi

💡 🤔
ye3i
ye3i

💻 🤔
Heorhi Shakanau
Heorhi Shakanau

💻 🤔
Felipe Plets
Felipe Plets

💻 🎨 💡 📖 🤔 ⚠️
jkubiszewski
jkubiszewski

💻
Heorhi Shakanau
Heorhi Shakanau

💻
NagornovAlex
NagornovAlex

💻
Joseph Davis
Joseph Davis

💻
Arooba Shahoor
Arooba Shahoor

💻
Maximilian Wright
Maximilian Wright

📖
Jakub Stawiarski
Jakub Stawiarski

💻
Paweł Kubiak
Paweł Kubiak

💻
Egor Volvachev
Egor Volvachev

💻
Daniel Bou
Daniel Bou

💻

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!

Omniboard.dev - getting started in less than 5 minutes

版本与发布记录

@angular-extensions/elements 共发布 76 个版本,首次发布于 2019/07/13;过去 12 个月发布了 3 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
22.0.0latest2026/08/212 个月前
21.0.12026/08/202 个月前
21.0.02026/08/202 个月前
20.0.22025/05/291.4 年前
20.0.12025/05/291.4 年前
20.0.02025/05/291.4 年前

其他发布通道:6x-versions → 6.1.0,7x-versions → 7.4.0,9x-versions → 9.4.0,8x-versions → 8.12.1。

关于 @angular-extensions/elements 的常见问题

如何安装 @angular-extensions/elements?

在项目目录运行 npm install @angular-extensions/elements,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:@angular/common(>=22)、@angular/core(>=22)、rxjs(>=7.5.0)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。

@angular-extensions/elements 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@angular-extensions/elements 支持 ESM 还是 CommonJS?

以 ES Module 形式发布,推荐使用 import 引入。在 CommonJS 项目中,Node.js 20.19+ / 22.12+ 可以直接 require() 不含顶层 await 的 ES Module,更早的版本需要改用动态 import()。

@angular-extensions/elements 可以商用吗?

@angular-extensions/elements 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@angular-extensions/elements 的下载量有多少?

根据 npm 官方下载统计,@angular-extensions/elements 在 2026/10/06 – 2026/11/04 这 30 天内被下载 70,406 次,日均约 2,347 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@angular-extensions/elements 还在维护吗?

最新版本 22.0.0 发布于 2026/08/21(2 个月前);至今共发布 76 个版本,其中过去 12 个月发布了 3 个;首次发布于 2019/07/13。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。