extension-mechanism-demo icon indicating copy to clipboard operation
extension-mechanism-demo copied to clipboard

Load Extension with Angular modules

Open nmarra opened this issue 6 years ago • 3 comments

Hi @maximusk ,

I've run into an issue using the extension mechanism and I've made a sample repo library up that demonstrates the issue: https://github.com/nmarra/extension-angular-issue

I'm trying to add some simple Angular code into the extension code ( *ngIf ), which requires me to import the CommonModule. I've tried multiple solutions to get this working but the Platform module constantly throws the below error when loading the Extension module:

ERROR Error: Uncaught (in promise): Error: StaticInjectorError(AppModule)[NgIf -> ViewContainerRef]: StaticInjectorError(Platform: core)[NgIf -> ViewContainerRef]: NullInjectorError: No provider for ViewContainerRef!

If there is any way you could spend some time looking at this and explain what I need to do to get it working I'd really appreciate it. I'm trying to build out a bigger extension example that has services and may include 3rd party libraries, but immediately ran into this roadblock when trying to use some simple Angular code.

Thank you for any help!

nmarra avatar Jun 01 '18 19:06 nmarra

Hello @nmarra ,

I have a running example with "ngIf" (and other things like Angular Material) at https://github.com/stefanocke/extension-mechanism-demo. I think the issue with the original sample is that angular is contained in the vendor.js AND in the app.js.

After applying my change from https://github.com/stefanocke/extension-mechanism-demo/commit/fd220ffe4b4093e276639a00557a59c9fa185512 to your example, yours worked as well.

stefanocke avatar Sep 02 '18 16:09 stefanocke

how to compile in aot

100cm avatar Dec 11 '18 03:12 100cm

Hi @maxkoretskyi I'm trying to replace template string with templateUrl, but error tells me : http://localhost:8080/a1.component.html 404 (Not Found) could you help to resolve this problem? :) Thank you 3000 times

imwangji avatar Aug 06 '20 06:08 imwangji