How to use @angular/elements - 10 common examples

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 ng-alain / delon / src / app / app.module.ts View on Github external
Object.keys(EXAMPLE_COMPONENTS).forEach(key => {
      const element = createCustomElement(EXAMPLE_COMPONENTS[key].component, {
        injector,
      });
      customElements.define(key, element);
    });
    // icon
github dotCMS / core-web / projects / dot-keyvalue / src / dot-keyvalue / dot-keyvalue.module.ts View on Github external
ngDoBootstrap() {
        const elem = createCustomElement(DotKeyvalueComponent, {injector: this.injector});
        customElements.define('dot-keyvalue', elem);
        // const elem2 = createCustomElement(DotTestComponent, {injector: this.injector});
        // customElements.define('dot-test', elem2);
    }
}
github vogloblinsky / web-components-benchmark / todomvc / angular-elements / src / todo.module.ts View on Github external
constructor(private injector: Injector) {
        console.log('TodoModule cstr');
        const customElement = createCustomElement(MyTodo, { injector });
        customElements.define('my-todo', customElement);
    }
    ngDoBootstrap() {
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));
github hapinessjs / ng-elements-loader / projects / ng-elements-loader / src / lib / elements-loader.service.ts View on Github external
                map((_: CustomElementData) => createCustomElement(_.component, { injector: _.injector })),
                tap((customElement: any) => customElements!.define(selector, customElement)),
github angular / angular / integration / ng_elements / src / app.ts View on Github external
constructor(private injector: Injector) {
    customElements.define('hello-world-el', createCustomElement(HelloWorldComponent, {injector}));
    customElements.define(
        'hello-world-shadow-el', createCustomElement(HelloWorldShadowComponent, {injector}));
    customElements.define('test-card', createCustomElement(TestCardComponent, {injector}));
  }
  ngDoBootstrap() {}
github ng-vcl / ng-vcl / wc / main.ts View on Github external
ngDoBootstrap() {
    let elm: any;

    elm = createCustomElement(FlipSwitchComponent, {injector: this.injector});
    customElements.define('vcl-flip-switch', elm);

    elm = createCustomElement(BusyIndicatorComponent, {injector: this.injector});
    customElements.define('vcl-busy-indicator', elm);

    elm = createCustomElement(ButtonComponent, {injector: this.injector});
    customElements.define('vcl-button', elm, {
      extends: 'button'
    });

  }
}
github AngularFirebase / 102-angular-elements-firebase / src / app / app.module.ts View on Github external
ngDoBootstrap() {
    const el = createCustomElement(UserPollComponent, { injector: this.injector });
    
    customElements.define('user-poll', el);
   }
}
github goodmite / ng-bubble / src / app / app.module.ts View on Github external
ngDoBootstrap() {
    if (environment.production) {
      const el = createCustomElement(EditorWrapperComponent, { injector: this.injector });
      customElements.define('js-bubble', el);
    }
  }
github OpenVidu / openvidu-call / front / openvidu-call / src / app / app.module.ts View on Github external
constructor(private injector: Injector) {
    const strategyFactory = new ElementZoneStrategyFactory(WebComponentComponent, this.injector);
    const element = createCustomElement(WebComponentComponent, { injector: this.injector, strategyFactory });
    customElements.define('openvidu-webcomponent', element);
  }

@angular/elements

Angular - library for using Angular Components as Custom Elements

MIT
Latest version published 4 days ago

Package Health Score

98 / 100
Full package analysis