How to use the @angular/elements.registerAsCustomElements function in @angular/elements

To help you get started, we’ve selected a few @angular/elements examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github playerx / angular-elements-sample / src / main.ts View on Github external
import { enableProdMode, destroyPlatform, Type, NgModuleFactory, CompilerFactory } from '@angular/core';
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
import { registerAsCustomElements } from '@angular/elements';

import { AppModule, webComponents } from './app/app.module';
import { environment } from './environments/environment';
import { platformBrowser } from '@angular/platform-browser';

if (environment.production) {
  enableProdMode();
}

destroyPlatform();

const bootstrapFn = () => platformBrowserDynamic().bootstrapModule(AppModule);
registerAsCustomElements(webComponents, bootstrapFn)
  .then(() => console.log('Web Components are ready!'))
  .catch(err => console.log(err));

@angular/elements

Angular - library for using Angular Components as Custom Elements

MIT
Latest version published 3 days ago

Package Health Score

98 / 100
Full package analysis