Kiran
Kiran

Reputation: 431

Issues implementing Angular Dynamic Components - AOT & Change Detection

I am trying to implement an Angular library which will encapsulate the logic required to add dynamic components to the DOM. Applications that consume this library must be allowed to provide a list of Components that will be dynamic, and then define "outlets" where these dynamic components must be inserted at runtime.

My code is heavily inspired by two articles:

The basic structure of my code is as below:

My code is available at: https://github.com/kiranjholla/ng-dynamic-components. To run my code, just clone this Git repository and then type in npm install and npm start. This will first build the library using the option --prod, and then build the test application using the options --prod --aot=false --buildOptimizer=false, and then start a http-server instance to serve the dist folder

Now my questions: the above code works only when the application is built with --aot=false --buildOtimizer=false; when AOT is enabled, I get an error stating that the compiler is unavailable. enter image description here

But, I have already provided the Compiler specifically using the JitCompilerFactory. How can I get it to work with AOT??

Any help/pointers, greatly appreciated.

Upvotes: 1

Views: 278

Answers (0)

Related Questions