We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
createCustomElement
Including this library in a SSR project will break it. See angular/angular#24551
The solution is quite simple, just check platform before call createCustomElement
ngx-element.module.ts https://github.com/brunob15/ngx-element/blob/master/projects/ngx-element/src/lib/ngx-element.module.ts
import { NgModule, Injector, ModuleWithProviders, Inject, PLATFORM_ID } from '@angular/core'; import { isPlatformBrowser } from '@angular/common'; import { NgxElementComponent } from './ngx-element.component'; import { LAZY_CMPS_PATH_TOKEN } from './tokens'; @NgModule({ declarations: [NgxElementComponent], entryComponents: [NgxElementComponent] }) export class NgxElementModule { constructor(private injector: Injector, @Inject(PLATFORM_ID) private platformId: string) { // conditional import angular/elements if (isPlatformBrowser(platformId)) { const { createCustomElement } = require('@angular/elements'); const ngxElement = createCustomElement(NgxElementComponent, { injector }); customElements.define('ngx-element', ngxElement); } } static forRoot(modulePaths: any[]): ModuleWithProviders<NgxElementModule> { return { ngModule: NgxElementModule, providers: [ { provide: LAZY_CMPS_PATH_TOKEN, useValue: modulePaths } ] }; } ngDoBootstrap() {} }
The text was updated successfully, but these errors were encountered:
LGTM
Sorry, something went wrong.
No branches or pull requests
Including this library in a SSR project will break it. See angular/angular#24551
The solution is quite simple, just check platform before call createCustomElement
ngx-element.module.ts https://github.com/brunob15/ngx-element/blob/master/projects/ngx-element/src/lib/ngx-element.module.ts
The text was updated successfully, but these errors were encountered: