Categories: angular, typescript

Unable to create Custom Angular Element

1 answer

I am creating a custom Component which is being registered to module like this.


import { createCustomElement } from "@angular/elements";  @NgModule({   declarations: [ExtensionComponent],   entryComponents: [ExtensionComponent],   imports: [BrowserModule],   bootstrap: [] }) export class AppModule {   constructor(private injector: Injector) {   }    ngDoBootstrap() {     const extension = createCustomElement(ExtensionComponent, { injector: this.injector });     customElements.define('caas-extension', extension);   } } 

For this i am getting an error in the last line where i define the custom element "extension".


Argument of type 'NgElementConstructor<unknown>' is not assignable to parameter of type 'CustomElementConstructor'. 

I have updated cli version as well as suggested in other answer on the similar issue. Below are my version details

Angular CLI: 9.1.0-rc.0 Node: 12.13.0 OS: win32 x64 Angular: 9.1.0-rc.2 

All answers to this question, which has the identifier 60848231

The best answer:

I had same issue. To overcome this issue, I undo my changes on git to updated versions on package.json file and re-updated it with following command: ng update @angular/core --next

I hope this works for you too.

Last questions

how do i remove the switch on my home screen?
how to edit the JS date and time to update atuomatically?
How to utilize data stored in a multidimensional array
Powermockito not mocking URL constructor in URI.toURL() method
Android Bluetooth LE Scanner only scans when phone's Location is turned on in some devices
docker wordpress container can't connect to mysql container
How can I declare a number in java that is more than 64-bits? [duplicate]
Optaplanner solutionClass entityCollectionProperty should never return null error when simple JSON object passed to controller
Anylogic, get the time a pedestrain is in a queue
How do I fix this syntax issue with my .flex file?
Optimizing query in PHP
How to find the highest number of a column and print two columns of that row in R?
Ideas on “Error: Type is referenced as an interface from”?
JCIFS SmbFile.exists() and SmbFile.isDirectory() return false when it exists and I can listFiles()
PHP total order
Laravel booking system design
neural net - undefined column selected
How to indicate y axis does not start from 0 in ggplot?
Fragments in backStack
Spinner how to change the data